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

 

posted @ 2016-11-14 13:27  代码沉思者  阅读(19501)  评论(0编辑  收藏  举报