May 28, 2003 at 2:14 am
How can I remove Carriage Return -> char(13)
from a normal string
in tsql because I don't succeed with the replace function eg.
SELECT REPLACE(CHAR(13), mystring, '')
May 28, 2003 at 2:28 am
you have the parameters switched wrong
also it might be a good idea to out the newline character too
REPLACE(REPLACE(mystring,CHAR(13),''),CHAR(10),'')
May 28, 2003 at 2:33 am
Thanks a lot for that information,
I switched my parameter wrong here but not in the actual try but you are right it was because of the line feed : char(10)
March 27, 2015 at 8:58 am
This is fine but it removes all carriage returns and linefeeds, even ones you want to keep... Is there a solution for this?
SET line1 = 'line1'
SET line2 = 'line2'
SET lines = line1 + CHAR(13) + CHAR(10)
SET lines = lines + line2 + CHAR(13) + CHAR(10)
SET lines = REPLACE(REPLACE(lines, CHAR(13),''), CHAR(10),'')
lines = line1line2
not ...
line1
line2
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy