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

Need to Remove ' Single Quote From Column Contents 2

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
hi again,

There are several characters I need to strip-out of a column.

The 1 giving me a problem is the single quote.

This doesn't work:
UPDATE [Dealer Names And AddressesTEST]
SET [Dlr Name] = REPLACE([Dlr Name], '[']', '')

This of course gives a syntax error:
UPDATE [Dealer Names And AddressesTEST]
SET [Dlr Name] = REPLACE([Dlr Name], ''', '')

What's the trick?

Thanks a lot! John


 
The 1 thing I didn't try. That worked.

Thanks SQLDenis. I've learned a lot from you this week.

John
 
Try this

UPDATE [Dealer Names And AddressesTEST]
SET [Dlr Name] = REPLACE([Dlr Name], '''', '')

That's four single quotes. SQL Books online (BOL) states that to represent an embedded quotation mark, use two single quotes.

Alternately:
SET QUOTED_IDENTIFIER OFF
UPDATE [Dealer Names And AddressesTEST]
SET [Dlr Name] = REPLACE([Dlr Name], "'", "")

Setting QUOTED_IDENTIFIER OFF allows the use of double quotes as string delimiters.


Rob
---------------------------------------------------------------
There are 10 types of people in this world.
Those who understand binary, and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top