SSMS Tips and Tricks 3-13: Creating T-SQL templates
In another post, I mentioned how useful templates can be. I said that I’d discuss how to create them later. Well, that’s today.
I thought I’d take dropping a database as an example. The supplied template doesn’t work for me, so let’s create a new one.
Note: SQL Server 2016 SP1 introduced DROP DATABASE IF EXISTS but I find that option quite useless. It fails if anyone is connected to the database. And to disconnect people beforehand, you need to first check if it exists, so the statement is pointless.
2025-07-22