Category Archives: MS SQL Server

December 2009 IT Toolbox for TechNet Magazine

The December 2009 TechNet Magazine is on the website. Check out my IT Toolbox column here: December 2009 TechNet Magazine IT Toolbox In this issue I covered: Eraser: Eradicate Sensitive Information SQL Server Backup Pro from Red Gate: Streamline SQL … Continue reading

Posted in Microsoft TechNet, MS SQL Server | Leave a comment

T-SQL: Change Collation on your LIKE Clause Using COLLATE

Ever have trouble matching unicode letter equivalents in your T-SQL queries? For example, when you want “Québec” and “Quebec” to be equivalent in your text search query? This is where specifying Accent Insensative Collation (The “AI” in all those collation codes) comes … Continue reading

Posted in MS SQL Server, T-SQL | Leave a comment

T-SQL Hack to Turn a Set of Row Values into a Delimited String

Ever want to turn multiple rows into a comma separated list when you are querying your database? Here’s a quick way to get it done using “FOR XML PATH(”)”:   DECLARE @comma_delimited_list VARCHAR(6000) SELECT @comma_delimited_list = ( SELECT productName + … Continue reading

Posted in MS SQL Server | Leave a comment

Quick Method of Finding Out What Version and Service Pack your SQL Server Instance is Running

If you are looking for a quick way to verify the service pack and version applied to your SQL server instance, try the following T-SQL:   SELECT SERVERPROPERTY(’productversion’) AS productversion, SERVERPROPERTY(’productlevel’) AS productlevel, SERVERPROPERTY(’edition’) AS edition Hope this helps!

Posted in MS SQL Server | Leave a comment

How to put a database into Single User Mode with T-SQL

You can easily put a database into or take it out of single user mode with the following T-SQL:   ALTER DATABASE [MyDatabase] SET SINGLE_USER WITH NO_WAIT GO   ALTER DATABASE [MyDatabase] SET MULTI_USER WITH NO_WAIT GO

Posted in MS SQL Server | Leave a comment

Time Your T-SQL Queries

Here’s a quick way to get some timing statistics on your T-SQL:   DBCC FREEPROCCACHE GO DBCC DROPCLEANBUFFERS GO SET STATISTICS TIME ON GO   — Insert your query here   SET STATISTICS TIME OFF GO After you run the … Continue reading

Posted in MS SQL Server | Leave a comment