November 1, 2007 at 7:00 pm
I have a file created by the DoCmd.TransferText method that contains several rows. When loading this file into a SQL Server table using Bulk Insert (with the default row terminator of ) only the first row is being inserted.
I've tried other possible row termination options (\r, \r, \\ etc) without luck.
Does anyone know what row terminator the TransferText method uses to mark row ends?
November 1, 2007 at 8:39 pm
??
--Jeff Moden
Change is inevitable... Change for the better is not.
November 4, 2007 at 11:36 am
Well that was helpful. Was the ?? because you don't know or because the the fact that the '\ n' terminator character from my post went missing in action which made my message somewhat confusing?
November 4, 2007 at 5:01 pm
Sorry, I didn't check my post and I submitted it... I had included backslash n and apparently, it didn't take on this forum....
Have you tried backslash n ??
(and, now you know where the double ?? marks came frome 😉 )
--Jeff Moden
Change is inevitable... Change for the better is not.
November 5, 2007 at 10:43 am
Yes, backslash n was the set of characters that disappeared from my message and left it confusing.
I have found the problem and its interesting. The file had a header record (not a column-header, it held some data describing the file and a record-count) which had a different column content to the rest of the records, but had the same row terminator.
Although my BULK INSERT statement included FIRSTROW = 2, SQL Server got confused and combined the header row and the first data row and started its insert at the second data row (which was the third record in the file - which only had three records). I stripped out the header row via a VB Script and all was good.
What surprised me was that SQL Server expected all the file records to be the same and didn't seem to be able identify the terminator for the first record.
Never mind, thank you for your help.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply