May 5, 2005 at 9:41 am
How can I remove the "enter" character from the contents of an SQL Server Tables and replace it with a space character or with a "-" character?
for example I have the following table contents:
"Test1 Desc
Test2 Desc ?.?. 8162100"
and i want to update it with:
"Test1 Desc - Test2 Desc ?.?. 8162100"
Best regards,
kchrist
May 5, 2005 at 9:55 am
I use a proc to do this, it replaces the carriage return and the linefeed (either or both could be in the string)
CREATE PROCEDURE USP_REMOVE_CRLF @INSTRING VARCHAR(4000)
AS
SELECT @INSTRING = REPLACE(@INSTRING, CHAR(10), ' ')
SELECT @INSTRING = REPLACE(@INSTRING, CHAR(13), ' ')
SELECT @INSTRING
or as an update
UPDATE TABLEA
SET COLUMNB = REPLACE(REPLACE(COLUMNB, CHAR(10), ' '), CHAR(13), ' ')
May 5, 2005 at 10:15 am
Thank you very very much Nicholas !!!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply