DECLARE @Acc varchar(10), @Chars varchar(10)
DECLARE LISTA CURSOR LOCAL FOR
SELECT memb___id FROM MEMB_INFO
OPEN LISTA
FETCH NEXT FROM LISTA INTO @Acc
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE CHECKLISTA CURSOR LOCAL FOR
SELECT TOP 1 Name FROM Character WHERE (AccountID=@Acc)
OPEN CHECKLISTA
FETCH NEXT FROM CHECKLISTA INTO @Chars
IF @@ROWCOUNT = 0
begin
DELETE from MEMB_INFO where memb___id=@Acc
end
CLOSE CHECKLISTA
DEALLOCATE CHECKLISTA
FETCH NEXT FROM LISTA INTO @Acc
END
CLOSE LISTA
DEALLOCATE LISTA
and please, if u want to test it BEFORE delete, change line:
Quote:
DELETE from MEMB_INFO where memb___id=@Acc