sql语句把字段中的某个字符去掉

Posted 叶长种-.Net软件工程师

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql语句把字段中的某个字符去掉相关的知识,希望对你有一定的参考价值。

 sql语句把字段中的某个字符去掉

update Notifications set Accessory=replace(Cast(Accessory as varchar(8000)),http://demo.m-school.net,‘‘)

 例如:

update Notifications set Accessory=replace(Cast(Accessory as varchar(8000)),http://192.168.2.180,‘‘)
update Notifications set Accessory=replace(Cast(Accessory as varchar(8000)),http://zpzx.m-school.net,‘‘)
update Homeworks set Accessory=replace(Cast(Accessory as varchar(8000)),http://192.168.2.180,‘‘)
update Homeworks set Accessory=replace(Cast(Accessory as varchar(8000)),http://zpzx.m-school.net,‘‘)
update OpenCourses set Attachment=replace(Cast(Attachment as varchar(8000)),http://192.168.2.180,‘‘)
update OpenCourses set Attachment=replace(Cast(Attachment as varchar(8000)),http://zpzx.m-school.net,‘‘)
update OpenCourses set Audio=replace(Cast(Audio as varchar(8000)),http://192.168.2.180,‘‘)
update OpenCourses set Audio=replace(Cast(Audio as varchar(8000)),http://zpzx.m-school.net,‘‘)
update ListenCourses set Attachment=replace(Cast(Attachment as varchar(8000)),http://192.168.2.180,‘‘)
update ListenCourses set Attachment=replace(Cast(Attachment as varchar(8000)),http://zpzx.m-school.net,‘‘)
update ListenCourses set Audio=replace(Cast(Audio as varchar(8000)),http://192.168.2.180,‘‘)
update ListenCourses set Audio=replace(Cast(Audio as varchar(8000)),http://zpzx.m-school.net,‘‘)

老师,学生,家长头像:

update Sys_User set Portrait=replace(Portrait,http://zpzx.m-school.net,‘‘)
update Students set Portrait=replace(Portrait,http://zpzx.m-school.net,‘‘)
update Parents set Portrait=replace(Portrait,http://zpzx.m-school.net,‘‘)

 

以上是关于sql语句把字段中的某个字符去掉的主要内容,如果未能解决你的问题,请参考以下文章

SQL中如何删除某个字段内容的第一个字符

sql 表中一个字段含有大量的中文字符,怎么替换掉

怎么将带特殊字符的字符串存入sqlserver的某个字段

sql,如何把最后一个/去掉 ??

sql中如何判断字符串中含有特殊字符

oracle 去掉字符,剩下数字