Hi there all.
I need to fire specific events (like a database backup) after a certain number days. Let's say every 60 days. I need this to be based on firstly the date a database was created, so 60 days after that. Then once the database has been backed up, the last backup date needs to be used instead of the creation date.
How can I programmticly get those two dates? I was wondering if there isn't maybe like a system stored proc like the one to check a databases allocated space and available space.
Thanks in advance.
Keith.
You don't need to. All you need to do is to use something like this...
SELECT DATEDIFF(DAY,create_date,GETDATE()) % 80FROM sys.databasesWHERE name LIKE 'MyDatabase'
... and just do the backup when the result is zero, or whatever. Much simpler