question

HRugbeer avatar image
HRugbeer asked

When Outputing a query to CSV I get Spaces. How do I get rid of spaces

I have a query that I run. I change the results to file and save it as Output.CSV Under Query options.> results > text> I change the output format to Comma delimited. before runing the query After I run the query and view my results, I find fields with one value example (Y). have a space or 2 inserted next to it. How do I get rid of this space.
tsql
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@HRugbeer - you have been a member of this site for quite some time now, and have asked a good number of questions - would you be able to find the time to go and mark some of the answers you have been given as the answer to your questions? Not only will you earn more karma, you will be helping future users of this site.
1 Like 1 ·

1 Answer

· Write an Answer
Kev Riley avatar image
Kev Riley answered
The value may be stored as a fixed-value character field (i.e char), so trim the trailing spaces using `rtrim(YourField)`
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.