Monday 15 October 2012

MS SQL - How to fix problem with exporting varchar field into excel

Sometimes special characters in varchar field are the reason why after exporting data into excel - it is not properly formatted (part of the record is moved to the new line)
- to resolve - simple exclude these characters while querying the database

REPLACE(REPLACE(REPLACE(FieldName, CHAR(10), ''), CHAR(13), ''), CHAR(9), '') AS [FieldName]

No comments:

Post a Comment