declare @str varchar(100)
set @str='13abc2'
if charindex('abc', @str)<>0
--存在abc
set @str=replace(@str, 'abc', 'efg')
else
set @str=@str+'efg'
select @str
set @str='13abc2'
if charindex('abc', @str)<>0
--存在abc
set @str=replace(@str, 'abc', 'efg')
else
set @str=@str+'efg'
select @str
解决方案 »
- sql server 2008 r2的数据库,能够给 sql server 2008的服务器使用吗?
- 动态语句 行转列 如何没列低下加上合计?
- sql server安装程序遇到以下错误:MeiGetProductInfo无法检索Product Code.安装sql sever2008时,Win7旗舰版
- SQL高级语法,别人考了我,我不知道,您哪
- 简单的SQL语句
- case 函数很费解
- 如何让英文SQL支持中文?
- 关于C++程序设计语言(特别版)
- 求SQL2000的中文联机帮助文档,用google没有找到,如果有的话可以发给我
- 火车售票如何生成座位号?
- 高分求数据库查询的解决方法
- 请问,Char和varchar在数据库存取速度上有何影响?
update
table
set
字段 = replace(字段,'abc','efg')
where
charindex('abc',字段) > 02、
update
table
set
字段 = isnull(字段,'')+'efg'
where
charindex('abc',字段) = 0
tablename
set
col=case when charindex('abc', col)<>0 then replace(col, 'abc', 'efg') else col+'efg' end