Tag Archives | SQL

TSQL to Kill All Connections to a Database

Awesome snippet of code from Nick Xu’s SQL Server Blog to kill all connections to a database. Really useful when you’re getting messages like ‘Exclusive access could not be obtained because the database is in use’. I should mention – DON’T GO USING THIS ON YOUR PRODUCTION DATABASES!!!

Thank you Nick Xu!

Continue Reading 0

Useful SQL Split to Table Functions for CSV

Here are a couple of sql functions that I use a lot for handling CSV parameters to stored procs: Split To Table The first function splits a delimited string into a table:

This returns a table variable with 2 columns, Part (the delimited part of the string) and PartNumber (the part index). You can […]

Continue Reading 0