28,408
社区成员
发帖
与我相关
我的任务
分享
declare @id as int
declare db cursor for
select id from tab1 where datediff(m,时间字段,getdate())>=3
open db
fetch next from db into @id
while @@fetch_status = 0
BEGIN
delete from tab1 where id=@id
fetch next from db into @id
end
close db
deallocate db