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)
 importing Unix text files into SQL 2000 via interactive bulk insert

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-06-02 : 07:37:01
Ilan writes "I've discovered that many text files (comma delimited) that I recieve from out clients who use Unix have the row delimiters which consist of just a line feed. I use a sql stored procedure to execute a bulk insert command, but I have become aware that unless I use a format file. SQL Automatically turns a row terminator of \n into \r\n. So My import fails. Now using DTS, I would just select the option to use a {lf} instead of the default {cr}{lf}. Now I have it so that the number of fields of the import are generated "on-the-fly" utilizing sp_executeSQL, so I cannot generate a format file.

My question is, is there anyway around the fact that SQL automatically adds the Carriage Return to the newline control when using Bulk Insert interactively?

Thanks,
Ilan"

uadrive
Starting Member

1 Post

Posted - 2004-03-05 : 18:20:37
The solution is in the Bulk Insert statement, instead of looking for \n directly in the string, create an instance of a char and set it to char(10). They using this value in your bulk insert statement, you will be able to BULK INSERT correctly.
Go to Top of Page
   

- Advertisement -