April 29, 2008 at 1:02 pm
Hi all,
I have a problem during the bulk insertion. SQL truncated each line of the file.
The format file is:
9.0
1
1 SQLCHAR 0 8000 "\r" 1 if1 ""
I tried the following format too:
9.0
1
1 SQLCHAR 0 8000 "\r" 1 if1 ""
9.0
1
1 SQLCHAR 0 8000 "" 1 if1 ""
Table:
CREATE TABLE #if1 (
[if1] [varchar] (8000) NULL
)
Query:
SET @sqlstr = 'BULK INSERT #if1 FROM ''' + @inputfilepath + '.if1'' WITH (FORMATFILE = ''' + @ifformat + '.fmt1'')'
EXEC(@SQLSTR)
Everything is fine. The only problem is the lines are truncated.
Any ideas?
April 29, 2008 at 4:02 pm
Truncated? Do you mean you were expecting 8000 characters and got less? What does your input data look like?
April 29, 2008 at 8:47 pm
Try using backslash n instead of backslash r. Some text files only have a "linefeed" or "newline" character instead of an actual carriage return.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply