Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ganny
Yak Posting Veteran
51 Posts |
Posted - 2010-02-10 : 07:24:05
|
| Hi,I am facing a problem with single quotes in my table. I just want to show the table data without single quotes as mentioned below.My current table:Id Name code---------------------10 XUUS'22CC M111 XUSY'33DC M112 DXX'44KO M2Expected output to show:Id Name code---------------------10 XUUS22CC M111 XUSY33DC M112 DXX44KO M2Kindly help me, how to remove quotes from my table.Thank you. |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-10 : 07:25:46
|
| [code]UPDATE USET [Name] = REPLACE([Name], '''', '')FROM MyTable AS UWHERE [Name] LIKE '%''%'[/code]Take a backup first. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-10 : 07:26:40
|
You can mask a single quote with a second single quote:selectId,replace([Name],'''','') as [Name],codefrom table No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-10 : 07:27:23
|
 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
ganny
Yak Posting Veteran
51 Posts |
Posted - 2010-02-10 : 07:30:08
|
quote: Originally posted by webfred You can mask a single quote with a second single quote:selectId,replace([Name],'''','') as [Name],codefrom table No, you're never too old to Yak'n'Roll if you're too young to die.
Dear webfred, Thank you for the assistance. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-10 : 07:33:00
|
my pleasure  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-10 : 07:43:42
|
| http://beyondrelational.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspxMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|