DECLARE @username char(15)
DECLARE D_lj_cursor CURSOR FOR
SELECT [FLD_CHARACTER] FROM [game1].[dbo].[TBL_CHARACTER]
WHERE [FLD_DELETED]=1 OR ([FLD_LEVEL]<21 AND FLD_UPDATEDATETIME < ’2004 - 9 - 14’)
OPEN D_lj_cursor
FETCH NEXT FROM D_lj_cursor INTO @username
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT ’正在删除 ’+@username+’ 的相关资料......’
DELETE FROM [game1].[dbo].[TBL_MAGIC] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_ITEM] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_SAVEDITEM] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_QUEST] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_FACEIMG] WHERE [FLD_USERNAME] = @username
DELETE FROM [game1].[dbo].[TBL_SUBHUMAN] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_ABILITY] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_CHARACTER] WHERE [FLD_CHARACTER] = @username
DELETE FROM [game1].[dbo].[TBL_ITEMMARKET] WHERE [FLD_SELLWHO] = @username
FETCH NEXT FROM D_lj_cursor INTO @username
END
CLOSE D_lj_cursor
DEALLOCATE D_lj_cursor
===================================
注意:使用前备份你game1的数据库,这个脚本是将已被用户删除的人物 且 2004年9月14日前没到21级的人物全部删除。
[FLD_DELETED]=1 OR ([FLD_LEVEL]<21 AND FLD_UPDATEDATETIME < ’2004 - 9 - 14’)
上面这段就是控制时间等级的。 21和2004-9-14 。自行修改适合自己的就可以了。
===================================
不会用SQL查询分析器,请自行查找应用教程或说明。
|
|