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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 replace single quote in database column

Author  Topic 

rowter
Yak Posting Veteran

76 Posts

Posted - 2011-07-21 : 11:11:00
Hi,

I need to replace "'" in database columns with a empty space.
How do i do this?

update mytbl set fieldnm = fieldnm.replace(

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-07-21 : 11:13:28
update mytbl set fieldnm = replace(fieldnm,'''','')

Also refer this
http://beyondrelational.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2011-07-21 : 11:14:12
[code]
UPDATE f
SET [column] = REPLACE([column], '''', '')
FROM <table> AS f
[/code]

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

rowter
Yak Posting Veteran

76 Posts

Posted - 2011-07-21 : 16:41:22
Thank you madhivanan and Transact Charlie
Go to Top of Page
   

- Advertisement -