Automatically delete data from a database [modified]
-
Hi everyone, Is there a way to automatically delete information from fields in a database after sometime has passed? For example if I want to delete a user's info from my database after he or she has been inactive for so long? Is there a setting in SQL 2005 that would let me do that or must I do it programmatically? Please explain the details of how to do this if you can or point me to a site that goes into details on this. Thank you in advance for your help.
modified on Tuesday, April 29, 2008 10:31 PM
-
Hi everyone, Is there a way to automatically delete information from fields in a database after sometime has passed? For example if I want to delete a user's info from my database after he or she has been inactive for so long? Is there a setting in SQL 2005 that would let me do that or must I do it programmatically? Please explain the details of how to do this if you can or point me to a site that goes into details on this. Thank you in advance for your help.
modified on Tuesday, April 29, 2008 10:31 PM
No, you can't do that. You can store a date stamp on a record, and the next time the DB is accessed, delete it as having timed out.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
No, you can't do that. You can store a date stamp on a record, and the next time the DB is accessed, delete it as having timed out.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Hi there Christian, I haven't bugged you in a while. So are saying that I can not automatically delete data from a SQL database through code and instead would have to delete it manually? If I write a function to access the database to make it search for the datetime field that has reached a preset time, then tell it to delete all info in the same row as the datetime, I think it would be possible to what I intended. The only problem is the function would have to be triggered by something outside of the database if the database can't communicate with the function. What is your opinion on that? Please give a better solution if you can think of one. Thanks in advance for your time.
-
No, you can't do that. You can store a date stamp on a record, and the next time the DB is accessed, delete it as having timed out.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Hi there Christian, I haven't bugged you in a while. So you are saying that I can not automatically delete data from a SQL database through code and instead would have to delete it manually? If I write a function to access the database to make it search for the datetime field that has reached a time limit, then tell it to delete all info in the same row as the datetime, I think it would be possible to what I intended. The only problem is the function would have to be triggered by something outside of the database if the database can't communicate with the function. What is your opinion on that? Please give a better solution if you can think of one. Thanks in advance for your time.
modified on Wednesday, April 30, 2008 12:14 AM
-
Hi there Christian, I haven't bugged you in a while. So are saying that I can not automatically delete data from a SQL database through code and instead would have to delete it manually? If I write a function to access the database to make it search for the datetime field that has reached a preset time, then tell it to delete all info in the same row as the datetime, I think it would be possible to what I intended. The only problem is the function would have to be triggered by something outside of the database if the database can't communicate with the function. What is your opinion on that? Please give a better solution if you can think of one. Thanks in advance for your time.
The main thing is, your DB won't do anything on it's own. You can write a service that calls the DB to delete timed out records, but the record doesn't matter until your next request anyhow, right ? So, just time stamp them and delete them before reading data from that table again.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Hi everyone, Is there a way to automatically delete information from fields in a database after sometime has passed? For example if I want to delete a user's info from my database after he or she has been inactive for so long? Is there a setting in SQL 2005 that would let me do that or must I do it programmatically? Please explain the details of how to do this if you can or point me to a site that goes into details on this. Thank you in advance for your help.
modified on Tuesday, April 29, 2008 10:31 PM