开发者

BCP export with a comma row delimiter

开发者 https://www.devze.com 2023-03-04 16:35 出处:网络
I currently have a sproc that is exporting data to a csv file using bcp.It currently works fine except due to a change of requirment the file no longer can have a \'\\n\' row delimiter and must now ha

I currently have a sproc that is exporting data to a csv file using bcp. It currently works fine except due to a change of requirment the file no longer can have a '\n' row delimiter and must now have a ',' row delimiter. From a quick search I found that the tag y开发者_运维百科ou need to add is '-r delimiter' however my export appears to now be in a different language encoding.

This is the logic I am using to build my execution query:

SET @tempSQL = 'bcp "select * from ' + @tempTableName + ' " queryout "' + @fileName +'" -T -c -t"," -r"," -k -CRAW'

Additional Details: When opening the file in Notepad++ or vim it looks fine however when viewed in notepad it looks like Chinese characters.


What encoding does Notepad think the file is? If I open an ASCII file wth Unicode selected for the encoding, that's what I see.

File -> Open, 'Encoding:' selector at the bottom of the dialog (on Win7)

0

精彩评论

暂无评论...
验证码 换一张
取 消