Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 22.09.2005, 20:59   #1
LDragonL
Архивный участник
 
Join Date: May 2005
Posts: 133
Default Need help with sql cleanup script

Hi,
I'm trying to make a cleanup script to delete accoutns from db that aren't used for like a month.
I tried much out myself (some examples below)
Can someone teach me how to use the correct commands.
Tried to look for explanations on google but i didn't find any understandable explanations.
Would be nice if someone can advice me on this one.

Greetz


DELETE FROM user_account WHERE last_logout < 20-8-2005 8:00:00
DELETE FROM user_account WHERE last_logout < 208200580000
DELETE FROM user_account where last_login = NULL
LDragonL is offline  
Old 22.09.2005, 22:00   #2
bob1122
Архивный участник
 
Join Date: Aug 2005
Posts: 278
Default

You basically have it, except data format is incorrect, try

Code:
DELETE FROM user_account WHERE last_logout < 20/08/2005
As for the entries with null, thats what i used to do, but the script was a little tricky you dont use < / = / > / blah blah you use IS

Code:
DELETE FROM user_account WHERE last_ip IS NULL
Hope Thats what you need, But i think you might want to wipe more than just the account, maybe user_auth, user_info. but its up to you.

P.S. sorry to pull the chain but, could you please pm me LDragon (Good thing :P)
bob1122 is offline  
Old 22.09.2005, 22:28   #3
bwgreen
Архивный участник
 
Join Date: Sep 2005
Posts: 408
Default

don't forget to make note of the account numbers so you can delete the characters to go with it the accounts take up very little.. the characters take up the most. especially the user_item
bwgreen is offline  
Old 24.09.2005, 11:45   #4
LDragonL
Архивный участник
 
Join Date: May 2005
Posts: 133
Default

Hi i want to thank you both for the nice reaction. :wink:
Now i only need to find out how to convert the time and date together in the script because the time and dae are like this in the db:
"10-9-2005 17:28:4"
Now i tried only the date but there are no rows affected when i do it like that so i must have the time too but i don't know how to describe the : symbol and in he db there seems to be a space between the date and time wich i can't define too.

Greetz LdragonL
LDragonL is offline  
Old 24.09.2005, 15:45   #5
BiGBoY
Архивный участник
 
Join Date: May 2005
Posts: 216
Default

Before u delete any data from db like "DELETE FROM user_account WHERE last_ip IS NULL" think again.
there r also data refering to that account in other tables like ssn, user_auth, etc...
I suggest u to do the script which will first check for crossreferences and than delete them all at once if u dont want to have buggy db.
BiGBoY is offline  
Old 24.09.2005, 15:47   #6
bob1122
Архивный участник
 
Join Date: Aug 2005
Posts: 278
Default

Quote:
Originally Posted by LDragonL
Hi i want to thank you both for the nice reaction. :wink:
Now i only need to find out how to convert the time and date together in the script because the time and dae are like this in the db:
"10-9-2005 17:28:4"
Now i tried only the date but there are no rows affected when i do it like that so i must have the time too but i don't know how to describe the : symbol and in he db there seems to be a space between the date and time wich i can't define too.

Greetz LdragonL
Umm well it might not of worked because i set the delete script to delete acconuts older than 4 days :|... What date do you want ?
bob1122 is offline  
Old 25.09.2005, 09:18   #7
LDragonL
Архивный участник
 
Join Date: May 2005
Posts: 133
Default

No the script doesn't work because in the db there is date with time. When we fill in only the date the script doesn't find any rows matching the script.

i just need to know wich symbol must be replaced in the script for this ":"

like 12/4/2005 10:30:00 but the space between it is causing an error too in sql query manager :S
LDragonL is offline  
Old 25.09.2005, 15:00   #8
iamrend
Архивный участник
 
Join Date: May 2005
Posts: 315
Default Re: Need help with sql cleanup script

Quote:
Originally Posted by LDragonL
DELETE FROM user_account WHERE last_logout < 20-8-2005 8:00:00
DELETE FROM user_account WHERE last_logout < 208200580000
DELETE FROM user_account where last_login = NULL
Do this is similar to do nothing. you must delete characters too and others fields like user_acount etc...
iamrend is offline  
Old 25.09.2005, 16:59   #9
LDragonL
Архивный участник
 
Join Date: May 2005
Posts: 133
Default

Mm yes, it's not as easy as i thought.
But i keep working on it when i learn those darn sql db scripts.
LDragonL is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 18:15.