Row Terminator not working:
-
Hi, I am using sql bulk copy to insert into table from txt file. The following code is is being used for row terminator but it does not work. it works with '\n'. But it should be work with Unix system as well. @BQUERY AS nVARCHAR(250) SET @BQUERY = 'BULK INSERT tblCustomer FROM ''' + @FILEPATH + ''' WITH ( FIRSTROW = 2, FIELDTERMINATOR = '','', ROWTERMINATOR = ''\x0A'' )' EXECUTE SP_EXECUTESQL @BQUERY
Shahzad Aslam Software Engineer Email: shehzadaslam@hotmail.com
-
Hi, I am using sql bulk copy to insert into table from txt file. The following code is is being used for row terminator but it does not work. it works with '\n'. But it should be work with Unix system as well. @BQUERY AS nVARCHAR(250) SET @BQUERY = 'BULK INSERT tblCustomer FROM ''' + @FILEPATH + ''' WITH ( FIRSTROW = 2, FIELDTERMINATOR = '','', ROWTERMINATOR = ''\x0A'' )' EXECUTE SP_EXECUTESQL @BQUERY
Shahzad Aslam Software Engineer Email: shehzadaslam@hotmail.com
-
Unix row terminators are not the same as windows. Windows uses \r\n, unix only uses \r Hope this helps
Bob Ashfield Consultants Ltd
I have tested this too, still not working.
Shahzad Aslam Software Engineer Email: shehzadaslam@hotmail.com
-
I have tested this too, still not working.
Shahzad Aslam Software Engineer Email: shehzadaslam@hotmail.com
-
Try doing a hex dump of your data and see exactly what character(s) delimit the lines. You can use multiple characters in your format file as record delimiters, so you should be OK.
Bob Ashfield Consultants Ltd
I have read the file using StreamReader it has given some info about file. File is encoded with UTF-8 with code page 65001. It shows \n as line terminator which is not work with SQL bulk Insert.
Shahzad Aslam Software Engineer Email: shehzadaslam@hotmail.com
-
I have read the file using StreamReader it has given some info about file. File is encoded with UTF-8 with code page 65001. It shows \n as line terminator which is not work with SQL bulk Insert.
Shahzad Aslam Software Engineer Email: shehzadaslam@hotmail.com