exec('alter table tb add sid int identity(1,1)')
delete a from tb a where not exists(select 1 from tb where id=a.id and sid<a.sid)
alter table tb drop column sid
delete a from tb a where not exists(select 1 from tb where id=a.id and sid<a.sid)
alter table tb drop column sid
exec('delete a from tb a where not exists(select 1 from tb where id=a.id and sid<a.sid')
exec('alter table tb drop column sid')
exec('delete a from tb a where not exists(select 1 from tb where id=a.id and sid<a.sid') 少了一个括号,