删除数据的问题。
declare @max int,@rowname varchar(400)
declare cur_rows cursor local for
select softname,count(*) from PE_soft where ChannelId=2 and softid>341270 and softid<1270000 group by softname having count(*) > 1
open cur_rows
fetch cur_rows into @rowname ,@max
while @@fetch_status=0
begin
select @max = @max -1
set rowcount @max
delete from PE_soft where softname = @rowname
fetch cur_rows into @rowname ,@max
end
close cur_rows
set rowcount 0
怎么删除新的记录,保留旧的记录.
上面的代码是删除旧的记录了。