Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,

I want to remove single quote from a customer table. i.e.,customer name 'Harish chanda' has to
be removed and updated with only Harish chanda

The single quote has to removed programmatically using sql query
Posted

update Customer set Name = REPLACE(Name,'''','')
 
Share this answer
 

HI,

I am assuming that you have data as follows

SQL
create table test(name varchar(10))


insert into test values('''Nikhil'''),('''KUNAL'''),('''AKHIL''')


in above case

if you want to remove ' only when you are selecting data. you can do it like

select REPLACE(name,'''','') as Names from test


but if you want to remove ' permanently from the name

use

update test set name=REPLACE(name,'''','')
 
Share this answer
 
v2
Assuming this is SQLServer,

SQL
update customer
set name = replace(name, char(39), '')
 
Share this answer
 
Try it..:)

SQL
update TableName set Name='Harish Chanda' where Name like '%Harish Chanda%'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900