Skip to main content

Shrinking Databases bit-by-bit to avoid long delays

Michael Jones has a neat script for shrinking databases in small chunks to avoid having the server locked up for a long period. declare @sql varchar(8000) declare @name sysname declare @sizeMB int declare @UsedMB int declare @FreeMB int declare @ShrinkMB int — Desired free space in MB after shrink set @FreeMB = 1000 — Increment […]

What with this database called [$(DatabaseName)] ?

What with this database called [$(DatabaseName)] ?

I just handed a work mate an output script from DataDude, which he ran in Management Studio. Instead of producing the expected database he ended up with one called $(DatabaseName) Remember database pro uses SQLCMD to deploy databases If you use Management Studio to run an output script, you’ll need to swap into SQLCMD mode […]

Tip: Use Named Parameters with Stored Procedures when Unit Testing (VSTS Database Professionals)

I’ve been migrating unit tests to a new Visual Studio Database Professionals project. So far there’s been no problems (other than trying to find a naming standard). This problem had me scratching my head for a few minutes today. I defined a unit test for a stored procedure as: DECLARE @ItemCode varchar(32), @PriceLevel varchar(32) SELECT […]

The Five Easy Steps of Unit Testing for Database Professionals

Now that Microsoft have released Visual Studio Team Suite for Database Professionals (aka [story:datadude]) its time for SQL Server developers and dbas to learn more about Unit Testing. There is many different methods to test a database within the framework set by Visual Studio. So how do you know which way is best? Well one […]