I have data in input file given below -->
------- End of data----
Notice i have an empty rows after second row.
I m doing bulk insert with FIELDTERMINATOR = ',',ROWTERMINATOR = '\n'. It works perfectly fine when bulk inserting after removing the empty records. But when there is empty record at end of file, it is throwing error given below and no records are inserted in db. I cannot ask the user to remove empty line at EOF.
Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
i need get data of checkbox which inside a gridview this grid inside another grid i have used concept called masterdetail row inside it i have placed a control called checkbox now i need to that checked value......... how it is possible please help me with code using asp.net and C#......
SQL Server will return a null date as 01/01/1900 if one castes a null string to a date.
Now the issue is that someone had the idea of populating dates with 01/01/1900 to signify a certain stage with a row(meaning that the date is not known but it is known that that stage has been reached).
I only realised yesterday that this could cause an issue if a query is written where a null string is compared to one of these dates.
Does anyone else have experience of this and any suggestions?
I am currently thinking of changing these 01/01/1900 dates to 01/01/1901 to remedy this potential problem.
“That which can be asserted without evidence, can be dismissed without evidence.”
This is related to the Connection Type you ar using (ADO.NET, OLE DB, ODBC...).
If you are using MS Access you will see:
[Null] dates returns/saves [01/01/1900]
[Bit] field returns [-1] or 
Just a moment ago a friend asked me about the same problem, he is developing on Visual Studio .NET 2008 SP1 (I really did not checked his code, but he resolved his problem).
@Delimitervarchar(20) = ','
WITH cte (Idx, StartIndex, EndIndex) As
UNIONALLSELECT1 + Idx,
CAST(1 + EndIndex Asint),
CharIndex(@Delimiter, @Value, 1 + EndIndex)
EndIndex > 0
SubString(@Value, StartIndex, CASEWHEN EndIndex > 0THEN EndIndex - StartIndex
END) As Value
Then you can build a single query:
WITH ctePersonnelList (PersonnelBaseID) As
SELECTCASEWHEN Value Like'%[^0-9]%'THENNullELSE CAST(Value Asint)
cteDates (PersonnelBaseID, StartDate, EndDate) As
ctePersonnelList As L
INNERJOIN lfd_DailyStatistics As S
ON L.PersonnelBaseID = S.PersonnelBaseID
[Year] = @WorkPeriodYearAnd
WorkingPeriodID = @WorkPeriodIDGROUPBY
CAST(CASEWHEN Q.StartDate ISNULLTHEN0ELSE1ENDASbit) As NeedsRecalculation
cteDates As D
INNERJOIN lfd_dailyAbsence As A
ON A.PersonnelBaseID = D.PersonnelBaseID
And A.StartDate >= D.StartDate
And A.EndDate <= DateAdd(day, 1, D.EndDate)
LEFTJOIN lfd_CalculationQueue As Q
ON A.PersonnelBaseID = Q.PersonnelBaseID
And Q.StartDate <= D.EndDate
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
ok but what about performance ?
if i done this and this loop execute ,for example , for 15000 repeat
this is a optimal way?
and how can use one temp table and insert all resualt to this temp table?
I have just changed the db for a small app from using an MS ACCESS db (terrible thing!) to SSE 2008 R2 DB. Previously, they used to just copy the ACCESS db file each evening to a flash drive, and keep that off site. They have been using the app for a year now, and the SSE backup file is only about 20MB - in other words not that much data to backup. The server instance only has one database, and one additional user, no views or stored procedures or anything like that
1) What exactly do I need to back up? The database, system databases (master, model, msdb etc) log files?
2) How should I do the backup? (Been thinking along the lines of a backup command that can be run from the app (SMO), or possibly having a table in the DB with last backup date/time, and if a user logs on, and the last backup is older that a day, it makes a new backup. Or is there a better way? Can you schedule a job on SSE to do this daily?
3) I'm also not sure what options to use with respect to:
a) Backup Type (Full or Incremental?)
b) Copy-only Backup (No?)
c) Backup to existing medias set (yes) - Overwrite or Append?
4) The code I've tested using SMO
Backup bkp = new Backup();
bkp.Action = BackupActionType.Database;
bkp.Database = databaseName;
bkp.Incremental = chkIncremental.Checked;
Basically I want to end up with a backup (that can possibly be copied to some or other storage device as well for off site storage - flashdisk or portable drive) that in that case of the sever crashing completely, that I could restore to at worst a new instance of SSE?
Am i on the right track here?
Any other suggestions welcome!
modified 1-May-13 2:23am.
Last Visit: 31-Dec-99 18:00 Last Update: 1-Oct-23 11:45