Hi everyone,
I'm creating a online e-letter registration system. That saves 'temp' values to a 'temp' table, and then sends a automated email to the subscriber, from which he/she can then except, or decline the registration.
bu now i want to create a procedure, or some kind of funciton in T-SQL that will be scheduled to run every 2 or so hours, to check and see if there is any values in the temp table that is older than 24hours, and if that values is greater than 24hours, it must delete that values from the temp table... so that the temp table doesn't become too full of old, outdated data.
Please help.
Thanks
OK, thats an easy thing, but we need more input to see what you will have to do. Which SQL Server are you using ? The delete part would be the easiest, as it would turn out to be something like
DELETE FROM SomeTable Where DATEDIFF(dd,SomeDatecolumn,GETDATE()) >= 1
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||no, this is not SQL Server Express, It can be either the Developer Edition, or the Enteprise Edition...|||Then go straight ahead by creating a job, defining a schedule and inserting one step for executing the TSQL statement mentioned above.
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
No comments:
Post a Comment