question

mwalker200 avatar image
mwalker200 asked

Hi all, I have a question on a simple query that i cant get to work

I am looking to remove the carriage returns from a SQL query text file. I am using the following query and i think I should see the CR removed but it isnt.

select
	ltrim(rtrim(REPLACE(CAST(job_title AS VARCHAR(8000)), CHAR(13),''))) as title
FROM         mytable

Output :

title
Inside Sales
Decoration
sales
FAX AR PAST DUE
Design centre Manager
President/Owner
Expo Guest Only
sql query
10 |1200

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

ThomasRushton avatar image
ThomasRushton answered

Depending on the source/destination of your data, you may also need to remove/replace CHAR(10)...

10 |1200

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

mwalker200 avatar image
mwalker200 answered

The destination is a flat file. I have tried char(13) + char(10) with no luck as well

10 |1200

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

Anouk avatar image
Anouk answered

Try to replace the tab sign (char(9))

If that doesn't work, you should find out which invisible character is causing the problem. Best way to do that is to open the flat file in notepad ++ (Menu ViewShow Symbol → Show All Characters)

10 |1200

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.