![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Архивный участник
Join Date: Jan 2006
Posts: 607
|
Abstract: I found this problem while deleting unused and banned accounts. I realized there were some (few but some after all) accounts that were deleted even if they had characters on them. So I built this query to get the ID of those accounts. Hope this saves you some time if you need this.
Check the second post by Sauron This one will just print the account_id Code:
--declare variables declare @max int declare @current int declare @exist int --set variables USE LIN2WORLD SET @max = (SELECT TOP 1 account_id from user_Data ORDER BY account_id DESC) SET @current = (SELECT TOP 1 account_id from user_Data WHERE account_id!= -1 ORDER BY account_id ASC) --loop condition WHILE @current<@max BEGIN USE LIN2DB SET @exist = (SELECT COUNT(*) FROM user_account WHERE uid=@current) IF @exist = 0 PRINT @current USE LIN2WORLD SET @current = (SELECT TOP 1 account_id from user_Data WHERE account_id>@current ORDER BY account_id ASC) END This one will return the SELECT * FROM user_data WHERE account_id= the non existing account in LIN2DB Code:
--declare variables declare @max int declare @current int declare @exist int --set variables USE LIN2WORLD SET @max = (SELECT TOP 1 account_id from user_Data ORDER BY account_id DESC) SET @current = (SELECT TOP 1 account_id from user_Data WHERE account_id!= -1 ORDER BY account_id ASC) --loop condition WHILE @current<@max BEGIN USE LIN2DB SET @exist = (SELECT COUNT(*) FROM user_account WHERE uid=@current) IF @exist = 0 BEGIN USE LIN2WORLD SELECT * FROM lin2world.dbo.user_data WHERE account_id=@current END USE LIN2WORLD SET @current = (SELECT TOP 1 account_id from user_Data WHERE account_id>@current ORDER BY account_id ASC) END |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|