One way to keep track of your data- and log file sizes in SQL Server, is … Send email when log or data file growsRead more
SQL Server
Create XML with T-SQL function FOR XML
Some time ago I demonstrated how to use XQuery to map a hierarchical XML document into … Create XML with T-SQL function FOR XMLRead more
sys.dm_exec_cached_plans
The dynamic management view sys.dm_exec_cached_plans returns information on query plans currently in memory. This information can … sys.dm_exec_cached_plansRead more
How to fill in gaps in time series
In some cases it is necessary to have an unbroken time series, for instance to have … How to fill in gaps in time seriesRead more
Calculating Earned Premium in SQL Server
In most business, when a company receives payment for a sold product, that payment can be … Calculating Earned Premium in SQL ServerRead more
Sending HTML tables in mail from SQL Server
This post contains a template for sending HTML tables via mail in T-SQL. A prerequisite is … Sending HTML tables in mail from SQL ServerRead more
Capturing Blocked Queries
In a previous post, I presented a solution for monitoring and logging long running queries in … Capturing Blocked QueriesRead more
Capturing Long Running Queries
Long running queries in a database may or may not be a problem, depending on the … Capturing Long Running QueriesRead more
Capturing deadlock events
Traditionally, trace flags 1204 or 1222 are used to write information about deadlock events to the … Capturing deadlock eventsRead more
SQL Agent Workflows
How to control workflows using SQL Server Agent.