Checking database backup history

Sometimes, especially with large databases, the duration of a backup can be significant (e.g. multiple hours). So, if you’re wondering exactly how far along a backup is, and when it is estimated to complete, you can run the query below I hope that helps!

Investigating a Log Shipping process

One of the clients that I support has a DR (Disaster Recovery) environment set up. If you want to read a description on DR (and by extension, Log Shipping), then check out this page from Microsoft. Log Shipping and DR were relatively new processes to…

How to get a database out of Recovery Pending state

One of my clients recently suffered an outage for their production environment. The database structure includes Report Server Report Server Temp Transactional Transaction History During the outage all databases were in “Suspect” mode. I had never seen this status before, but it is not fun….

How to Rename a Database

If you ever need to rename a database, I recommend using the following script. It ensures no other users are connected. This is important, otherwise your connection won’t be able to gain a lock. I hope that helps!

Replace Text in a Database

If you need to perform an update on some text value in your database, you can easily get the job done using the REPLACE() function. I strongly suggest using the WHERE clause. You don’t want to accidentally update a row you didn’t mean to. I…

Use RowCount to determine query success

If you have a Stored Procedure that populates a temporary table, and you want to ensure the temporary table has been populated with something, you could use @@Rowcount. It’s an in-build property, and can be used as an alternative to selecting COUNT(1) from the temporary…

Another online code editor

In the past I have found and shared online resources for developers (e.g., and today I have another one! does basically what the URL suggests – it allows you to edit HTML. But it does it all in your browser. And it renders…

Setting NOCOUNT in your Stored Procedures

NOCOUNT is a SQL Server setting that (when activated) will stop SQL Server from returning the “x row(s) affected” message as part of its execution. Although this message is helpful with T-SQL queries in SQL Server Management Studio, it is of little use with Stored…

Excluding FILESTREAM when backing up a Database

When using a script to backup a SQL Server database, it can be tricky to exclude the filestream. But, you can exclude filestream by only including the Primary file group, which typically only includes the data and log files. I hope this helps.

Temporary Tables – Local vs Global

Hi all, I just wanted to share a link that has a great explanation on the difference between a local temp table, and a global one. Check it out here! And if you can’t be bothered checking it out, I’ll summarize.. A local temp table…