FETCH NEXT FROM LISTA INTO @Acc
WHILE @@FETCH_STATUS = 0
begin
if (SELECT COUNT(*) FROM Character where AccountID=@Acc) = 0
begin
DELETE from MEMB_INFO where memb___id=@Acc
DELETE from VI_CURR_INFO where memb___id=@Acc
select @test = @test + 1
end
FETCH NEXT FROM LISTA INTO @Acc
end
CLOSE LISTA
DEALLOCATE LISTA
print @test
• Para deletar as contas que estão a tantos dias sem connectar basta executar a seguinte query:
begin tran
delete memb_info
from
(
select memb___id from memb_stat where getdate()-DisConnectTM>365 --> (Número de dias que a conta está inativa)
) tbl
where memb_info.memb___id = tbl.memb___id collate database_default
commit