从SQL中的列替换单引号 [英] replacing single quote from a columns in SQL

查看:248
本文介绍了从SQL中的列替换单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



我想从客户表中删除单引号。即,客户名称'Harish chanda'必须 Harish chanda

/>
必须使用sql查询以编程方式删除单引号

解决方案

更新客户集名称= REPLACE(名称,'''','')


 

HI,



我是假设你有如下数据



 创建  table  test(name  varchar  10 ))


插入 进入 test ' ''Nikhil'''),(' ''KUNAL'''),(' ''AKHIL''')





以上情况



如果你想删除'只在你选择数据时。你可以这样做



选择REPLACE(name,'''','')作为test的名字





但如果你想永久删除名字



使用



更新测试集名称= REPLACE(名称,'''','')


< blockquote>假设这是SQLServer,



 更新客户
set name = replace(name, char 39 ),' '

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

解决方案

update Customer set Name = REPLACE(Name,'''','')


HI,

I am assuming that you have data as follows

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,'''','')


Assuming this is SQLServer,

update customer
set name = replace(name, char(39), '')


这篇关于从SQL中的列替换单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆