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?