第一个是:
在表名为“A”中的“B”列中,所有的"C"替换成“D”;第二个是:
在表A列名为“registertime”中,注册时间在比如2000-1-1到2008-12-31,且“B”没有“D”的,在“B”列中加入“E”谢谢啦!!
在表名为“A”中的“B”列中,所有的"C"替换成“D”;第二个是:
在表A列名为“registertime”中,注册时间在比如2000-1-1到2008-12-31,且“B”没有“D”的,在“B”列中加入“E”谢谢啦!!
update A
set B=replace(B,'C','D')
where charindex('D',B)>0--2.
update A
set B=B+'E'
where registertime>='2000-01-01' and registertime<'2009-01-01'
and charindex('D',B)=0
update A set B = replace(B, 'C', 'D') where B like '%C%'--2
update A set B = B + 'E' where registertime >= '2001-01-01' and registertime < '2009-01-01' and B not like '%D%'
where charindex('D',B)>0
-->
where charindex('C',B)>0
关键字 'User' 附近有语法错误。注意USER=A不知道错哪了。
结果又有某行出现影响。
update A
set B=replace(B,'C','D')
where charindex('D',B)>0
update A
set B=B+'E'
where registertime>='2000-01-01' and registertime<'2008-12-31 23:59:59.667'
and charindex('D',B)=0
UPDATE
SET B=REPLACE(B,'C','D')
WHERE CHARINDEX('C',B)>0--2:
UPDATE A
SET B=B+'E'
WHERE registertime BETWEEN '2000-1-1' AND '2008-12-31'
AND CHARINDEX('D',B)<=0
--1.
update A
set B=replace(B,'C','D')
where charindex('C',B)>0--2.
update A
set B=B+'E'
where registertime>='2000-01-01' and registertime<'2009-01-01'
and charindex('D',B)=0