Phenomenon: When the result set queried from SQL is copied to EXCEL, line breaks are found, as follows:
Solution: replace the character strings with Char(13) and Char(10), the code is as follows:
--原sql
SELECT Description'事由',DestinationLocation '第三层',BudgetTargetDetailID '第二层',Name'第一层' FROM dbo.BIZ_FIN_Payment(NOLOCK)
--替换后
SELECT REPLACE(REPLACE(Description,CHAR(10),' '),CHAR(13),' ')'事由',
REPLACE(REPLACE(DestinationLocation,CHAR(10),' '),CHAR(13),' ') '第三层',REPLACE(REPLACE(BudgetTargetDetailID,CHAR(10),' '),CHAR(13),' ') '第二层',
REPLACE(REPLACE(Name,CHAR(10),' '),CHAR(13),' ')'第一层'
FROM dbo.BIZ_FIN_Payment(NOLOCK) a
Effect after replacement: