current position:Home>SQL Server exports a section of data containing line breaks, and directly queries the exported data without line breaks

SQL Server exports a section of data containing line breaks, and directly queries the exported data without line breaks

2022-01-27 01:43:37 CSDN Q & A

SQL server Export a piece of data containing line breaks Direct query of exported data will not wrap the right side of the figure Want to wrap the effect picture left . Just want to export to excle The data in the table can wrap

img




Refer to the answer 1:

Tested the next use ssms export Excel, Even if it contains the complete \r\n You can't change the line when you enter , There may be a software problem , The title is generated in other server languages Excel File try .
Reference resources :c# Use NPOI Quickly export to excel
https://www.cnblogs.com/zxh1314/p/8342066.html




Refer to the answer 2:



Refer to the answer 3:

EXCEL Line breaks to be displayed in , Ensure that there are carriage return and line feed characters in the string , Your original data may have only one line feed or only one carriage return , Therefore, the situation seen in different procedures is different .
There are two ways to solve this problem , One is to update the data in the database to bring carriage return and line feed , Another way is to export sql in , Use replace, Replace line feed with carriage return plus line feed .
Carriage return yes char(13)
Newline is char(10)




Refer to the answer 4:



Refer to the answer 5:

take SQL Line breaks in fields , Replace with excel The line breaks inside That's all right. .
Grammar is

select REPLACE( Field 1,'/n','char(10)') from  surface 

Write something like this




Refer to the answer 6:



Refer to the answer 7:

Front end display innerHTML Property display .




Refer to the answer 8:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270143352932.html

Random recommended