Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Escape characters from a Field

Status
Not open for further replies.

hungerf5

IS-IT--Management
Sep 17, 2001
36
US
I'm extracting some data out of my server to be used in some dynamic JavaScript. I've run across a query that appears to have a carriage return in the text. I can tell there is a carriage return because when I view the JavaScript Source the code appears on two lines.

Actually the field in question starts off binary but I convert it to Text with the following line in my select statement:

CAST(CAST(RQB.BITS AS VARBINARY(8000)) AS VARCHAR(8000)) AS SPECS

I need to pull out double quotes (") and carriage returns from the field.

The Line below strips out the ".
REPLACE(CAST(CAST(RQB.BITS AS VARBINARY(8000)) AS VARCHAR(8000)), '"', '')

How do I get the carriage returns out?


--Rick
 
This code will replace a carriage return(13) and a line feed(10).

REPLACE(REPLACE(yourString,CHAR(10),''),CHAR(13),'')

Good Luck!
 
Thanks!

It wasn't a carrige return it was the line feed. I would have been chasing that one down for awhile if you wouldn't have mentioned it.

Thanks again....

--Rick --Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top