The sp_delete_database_backuphistory procedure removes the backup and restore history of one database from msdb, and sp_delete_backuphistory does it by age. The demo counts the rows of a database before and after the delete and previews the delete by age. The last sections explain how to keep the history small.
Counting Objects by Type in Every Database With One Query
One loop and one pivot give you tables, views, procedures and functions for every database. A planted demo database proves the counts.
SQL Job Schedules: Read Every Schedule in Plain English
SQL job schedules are stored as codes, and even the built-in description shows a time such as 60000. This post builds four demo jobs with five schedules and decodes every one with a single query. It also shows shared schedules, disabled schedules and jobs with no schedule at all.
Database Mail Health Check: Unsent Items and the Event Log
The alert job succeeded, yet nobody got the email. Here are three read-only checks that show whether Database Mail is really working.
How to Create a Table Automatically in All Newly Created Databases? – Interview Question of the Week #238
Question: How to Create a Table Automatically in All Newly Created Databases? This question was recently asked in my recent consulting engagement







