update a01 set a0101='aaa' where id not in ('0109%','0120%','0114%')这条语句报错,说 VARCHAR 转换成 INT 错误。但是这些字段类型都是VARCHAR的啊。 可能是语法上不能这样写,但是我想达到这个目的,不知道有什么好的办法,请高手指教。
update a01 set a0101='aaa' where id not LIKE '0109%' OR NOT LIKE '0120%' OR NOT LIKE '0114%'
update a01 set a0101='aaa' where charindex(rtrim(id), '0109,0120,0114')=0
update a01 set a0101='aaa' where id not in ('0109%','0120%','0114%') update a01 set a0101='aaa' where charindex('0109',id)<0 and charindex('0120',id)<0 and charindex('0114',id)<0
CREATE TABLE [dbo].[a]( [a] [varchar](20)) update a set a='aaa' where a not in ('0109%','0120%','0114%') 这样写没错
update a01 set a0101='aaa' where charindex(rtrim(id), '0109,0120,0114')=0
update a01 set a0101='aaa' where (','+CONVERT(VARCHAR(800),ID)+',',',0109%,0120,0114,' )=0
update a01 set a0101='aaa' where id not in ('0109%','0120%','0114%')
update a01 set a0101='aaa' where charindex('0109',id)<0 and charindex('0120',id)<0 and charindex('0114',id)<0
[a] [varchar](20))
update a set a='aaa' where a not in ('0109%','0120%','0114%')
这样写没错