Bulk insert, SQL Server 2000, unix linebreaks

后端 未结 8 950
旧时难觅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:44

    One option would be to use bcp, and set up a control file with '\n' as the line break character.

    Although you've indicated that you would prefer not to, another option would be to use unix2dos to pre-process the file into one with '\r\n' line breaks.

    Finally, you can use the FORMATFILE option on BULK INSERT. This will use a bcp control file to specify the import format.

提交回复
热议问题