I have a query I'm running to remove white spaces because TRIM was not working. The query is:
This removes the white spaces and aligns the items in the CSV format with an exception of one item. If I run the query in SSMS and copy and paste the data results the spaces are no longer there. But during export the item is splitting into 3 columns, though in SSMS it is one column.
Can someone assist me in finding a way to remove trailing spaces with what I have or maybe I need to try a different way? (Minus using TRIM because those options did not work.)
Any help is greatly appreciated!
asked Jul 11 '12 at 06:32 PM in Default
It's because the text itself contains commas. So when you export it in comma separated file, then the application which imports the data will handle it as 3 separate columns.
You will have to use another separator (eg. semicolon or tab). For Tab delimited file you have the option directly in SSMS. When exporting select the tab delimited format.
Other option would be text qualify the strings by putting them into double quotation marks if the importing application can handle this. You can achieve this easily by the