简体   繁体   中英

SQL Server 2014 export CSV file issues

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...

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.

SQL Server中的CR和LF是Char(10)Char(13)尝试从记录中取出这些字符,然后看是否有效:

SELECT REPLACE(REPLACE(@str, CHAR(13), ' '), CHAR(10), ' ')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM