I have searched for an answer on this, but have come up short. When exporting a table from SSMS, from time to time some of the larger files will have issues where something like an address will trigger a CR/LF and spread a record like an address across multiple rows in the exported CSV file. If I copy an paste the record directly from SSMS and paste it into another program such as word, it will do the same thing. I cant exactly put my thumb down on what is happening here. Other records will export correctly, and then all the sudden one of the records will come up like below...
我已经在这方面找到了答案,但是已经很短了。从SSMS导出表时,一些较大的文件会不时出现问题,例如地址之类的东西会触发CR / LF并在导出的CSV文件中的多行之间传播地址等记录。如果我直接从SSMS复制粘贴记录并将其粘贴到另一个程序(如word)中,它将执行相同的操作。我不能完全把拇指放在这里发生的事情上。其他记录将正确导出,然后突然其中一个记录将出现如下...
Looks something like this:
看起来像这样:
1|"Apartment Katha
2|Flat No 9999 Garia Place
3|West Bengal"
But I need it like this
但我需要这样的
1|"Apartment Katha Flat No 9999 Garia Place West Bengal"
I use Unicode and "
as the text qualifier.
我使用Unicode和“作为文本限定符。
1 个解决方案
#1
1
CR and LF in SQL server are Char(10)
and Char(13)
Try to take out these characters from your records, and see if it works:
SQL服务器中的CR和LF是Char(10)和Char(13)尝试从记录中取出这些字符,看看它是否有效:
SELECT REPLACE(REPLACE(@str, CHAR(13), ' '), CHAR(10), ' ')
#1
1
CR and LF in SQL server are Char(10)
and Char(13)
Try to take out these characters from your records, and see if it works:
SQL服务器中的CR和LF是Char(10)和Char(13)尝试从记录中取出这些字符,看看它是否有效:
SELECT REPLACE(REPLACE(@str, CHAR(13), ' '), CHAR(10), ' ')