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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REPLACE

Status
Not open for further replies.

shultz

Programmer
Joined
Oct 28, 2001
Messages
42
Location
HK
How can I use the REPLACE command on the SQL server to replace all the apostrophes with double apostrophes. For example I take a field called description which has a lots of "'"s.

UPDATE tblImport
SET [CSR DESCRIPTION] = REPLACE([CSR DESCRIPTION], "'", "''")

is the above syntax correct? It is not accepting the double quotes. Can anybody give me the equivalent one.

thanks.
 
Try this.

UPDATE tblImport
SET [CSR DESCRIPTION] =
REPLACE([CSR DESCRIPTION], char(39),char(39)+char(39))
 
Sorry, I forgot to tell you that the datatype is "NTEXT". Is it possible to do the above with these kinds of data.

thanks.
 
Don't know but I can't see why not. Why don't you copy a few records to a temporary table and try it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top