select id=identity(int,1,1),* into #t from 表 where 条件update #t set 字段='要修改的内容' where id=1 --or id=2delete from 表 where 条件insert into 表 select 字段1,... from #t
如果只有少数的,就直接进到企业管理其中删除如果有很多: 那就先select distinct * into t1 from table 然后把原来的table drop掉 把t1 rename 成原来的table名
declare @tb table(id int,status int,value varchar(10))insert @tb values(1,100,'AAA') insert @tb values(1,100,'aaa')set rowcount 1update @tb set value='ccc' select * from @tbset rowcount 0select * from @tb
用RowCount強制只更新一行Set RowCount 1 Update 表 Set 列=值 WHERE 條件 Set RowCount 0
那就先select distinct * into t1 from table
然后把原来的table drop掉
把t1 rename 成原来的table名
insert @tb values(1,100,'aaa')set rowcount 1update @tb set value='ccc' select * from @tbset rowcount 0select * from @tb
Update 表 Set 列=值 WHERE 條件
Set RowCount 0