服务热线 400-660-8066

深圳网站建设
首页 站内资讯

深圳网站建设

站内资讯
深圳网站建设 / 站内资讯 / 产品资讯 / 正文

MSSQL2005常用的数据库操作SQL语句

来源: All文章
发布时间:2023-03-24 15:09:43

  MSSQL2005常用的数据库操作SQL语句:

  批量替换标题或描述里的字符串

  update表名set要替换的字段=replace(要替换的字段,'要替换的字符','替换的字符')

  如updateproductssettitle=replace(title,'.net','www..net')

  如果要替换的字段不是nvarchar或varchar,需要转换,

  update表名set要替换的字段=replace(CAST(要替换的字段asvarchar(8000)),'要替换的字符','替换的字符')

  如:updateproductssetdescription=replace(CAST(descriptionASvarchar(8000)),'Swarovski','SwarovskiElements')wheredescriptionlike'%Swarovski%'

  当然也可以用于批量替换产品价格等

  如下:

  updateproductssetprice=price*5wherecategoryid=5

  updateproductssetprice=price*2wherecategoryidin(91,92,93,94,96,97,98,99,56,166,170,168,169,167,171,172,174,175,176,177,82,100,102,103,180,181,182,183)

  updateproductssetprice=price*4wherecategoryidnotin(5,91,92,93,94,96,97,98,99,56,166,170,168,169,167,171,172,174,175,176,177,82,100,102,103,180,181,182,183,185)

* 文章来源于网络,如有侵权,请联系客服删除处理。
在线 咨询

添加动力小姐姐微信

微信 咨询

电话咨询

400-660-8066

我们联系您

电话 咨询
微信扫码关注动力小姐姐 X
qr