- Joined
- Jun 5, 2006
- Messages
- 133
- Reaction score
- 0
This is to be used with the recently released disconnect user program made by gregg.
You can use any table name you want instead of disconnect_user
you also may need to edit it to be customized for your server. The duper table name and whatnot. This is my contribution.
Code:
alter Procedure DisconnectUsers
as
declare @struserid varchar(21), @old varchar(21),@count int, @count2 int
declare @row int
select @count = count(*) from knight_account.dbo.currentuser where strcharid in (select struserid from known_dupe)
while @count > 0
begin
DECLARE Backup_Cursor CURSOR FOR
SELECT distinct strcharid from knight_account.dbo.currentuser
where strcharid not in(select struserid from known_dupe)
OPEN Backup_Cursor
FETCH NEXT FROM Backup_Cursor INTO @strUserID
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @row = count(*)
FROM USERDATA
WHERE strUserID = @strUserID
select @count2 = count(*) from disconnect_user where userid = @struserid
IF @row > 0
BEGIN
if @count2 < 1
begin
insert into disconnect_user values (@struserid)
end
END
FETCH NEXT FROM Backup_Cursor INTO @strUserID
END
CLOSE Backup_Cursor
DEALLOCATE Backup_Cursor
end
You can use any table name you want instead of disconnect_user
you also may need to edit it to be customized for your server. The duper table name and whatnot. This is my contribution.