从MSSQL表中删除重复项

declare @ids int=1

declare @count int

while @ids<471

begin

select @count=COUNT(*) From LotNO where cLotNO=(select cLotNO From LotNO where Auto_ID=@ids)

if @count>1

begin

delete from LotNO where Auto_ID=@ids

end

select @ids+=1

end

posted @ 2013-11-09 10:45  enif  阅读(121)  评论(0编辑  收藏  举报
豫ICP备2021034901号