I have a SQL
table which is used to store a large number of logs.
I want to have a stored procedure or something along the lines of that. That runs every minute and deletes items from the end of the log table as long as the database size is above 200GB.
so something like:
While(databaseSize > 200GB)
{
Batch delete 100 entires From [dbo].[logs] OrderBy DateTime
}
How would I go about doing this?
[Edit]
SQL Azure limits my database size to 250GB. Hence why I need to limit and still keep a small buffer for other tables.
Best Answer
In a maintenance plan run something like this like hourly