![]() |
|
|
#1 |
|
Архивный участник
Join Date: Aug 2005
Posts: 145
|
this code cleanup database after char get deleted.
before use any script - backup your db ![]() Code:
begin tran delete from bookmark where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from nobless_achievements where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from olympiad_match where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from olympiad_result where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from Quest where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from shortcut_data where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from ssq_user_data where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_ActiveSkill where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_ban where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_blocklist where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_comment where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_deleted where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_friend where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_henna where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_history where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_item where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_log where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_macroinfo where macro_id in (SELECT macro_id FROM user_macro WHERE char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1))); delete from user_macro where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_mail where id in (SELECT mail_id FROM user_mail_receiver WHERE receiver_id in (select char_id from user_data where (account_id = - 1))); delete from user_mail where id in (SELECT mail_id FROM user_mail_sender WHERE sender_id in (select char_id from user_data where (account_id = - 1))); delete from user_mail_receiver where receiver_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_mail_sender where sender_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_newbie where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_nobless where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_punish where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_recipe where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_skill where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_sociality where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_subjob where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete from user_surrender where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)); delete FROM user_data WHERE (account_id = - 1); commit comments/suggestions are welcome. if u need to delete accounts that not used in 180 days change (account_id = -1) to (login < GETDATE() - 180) in next script we cleanup accounts that do not have any char
|
|
|
|
|