Bulk insert, SQL Server 2000, unix linebreaks

后端 未结 8 937
旧时难觅i
旧时难觅i 2020-12-13 13:05

I am trying to insert a .csv file into a database with unix linebreaks. The command I am running is:

BULK INSERT table_name
FROM \'C:\\file.csv\' 
WITH 
( 
         


        
8条回答
  •  感情败类
    2020-12-13 13:48

    It's a bit more complicated than that! When you tell SQL Server ROWTERMINATOR='\n' it interprets this as meaning the default row terminator under Windows which is actually "\r\n" (using C/C++ notation). If your row terminator is really just "\n" you will have to use the dynamic SQL shown above. I have just spent the best part of an hour figuring out why \n doesn't really mean \n when used with BULK INSERT!

提交回复
热议问题