Jason,
Upon further review of the code, and unless I am missing something, there could be an issue with the initialization of one of the variables in very large environments.
E.g.
declare @name char(30), @uid int, @suid int
select @suid = 9999
Later on in the body of the while loop processing the cursor, the variable is again reset to 9999. Presumably to wipe the previous "real" value, and provide some debugging capability.
However, in that case, why not let the variable retain its initial NULL value, and later reset it to NULL in the loop? I know that purists will argue that you cannot set a variable to NULL, but in T-SQL you can...
I would suggest initializing the variable to a value that will never occur... In other words, something that will not be assigned by ASE.
E.g.
select @suid = 0
FYI, in one of the test databases I am using right now, we already have 4000+ logins, and we are talking about not purging them... So over time, we could reach 10,000...
A bit far fetched, but, a potential bug nonetheless, don't you think?
Regards,
Jean-Pierre
Message was edited by: Jean-Pierre Dareys