Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Bulk Insert, \n is not character 10

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-11-03 : 07:41:47
Giles writes "I have been attempting to use BULK INSERT to load a file that has a ROWTERMINATOR of Character 10 (IE Newline).

The SQL Server manual states that the backslash escape character \n represents the newline character, but this does not work.

Some investigation has shown that it appears to add character 13 (carriage return) before character 10 to the ROWTERMINATOR when you use \n.

Given that BULK INSERT will not accept CHAR(10) in the parameters can you think of any other way of getting this to correctly recognise character 10 as the row terminator?

Thanks for any help you can give,

GILES"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-11-03 : 07:44:43
A line terminator (\n) in Windows/DOS is CHAR(13) + CHAR(10). A line terminator (\n) in Unix/Linux and variants is CHAR(10). You can use \r to load Unix-terminated through BULK INSERT or bcp.
Go to Top of Page
   

- Advertisement -