Get drive data for ALL drives in T-SQL

There are a few methods you can use to get drive information using T-SQL. The problem is all these methods have some limitations. They provide free space but not drive capacity or they only provide data for volumes that contain database files. Ideally Microsoft would provide an easy way to get both …

Continue reading →

Set Max Server Server Memory at Startup

Max server memory is one of the SQL Server configuration options that you should change from the default value. Brent Ozar has some good advice on this here. TLDR: You should leave some extra memory for the o/s. A good starting point is to leave 10% (4GB minimum). If you are running other processes …

Continue reading →

DBA Daily Checks Email Report

Update: This was my original solution to automate the DBA Checks process. I don’t recommend people use this solution as it doesn’t scale well to a larger number of servers and the CLR function used to get drive space requires the TRUSTWORTHY property to be enabled which can be a potential security …

Continue reading →

SQL Server CLR IO Utility

Warning: the use of TRUSTWORTHY described in this article can be a potential security risk so you might want to consider alternative options. Using CLR (.NET Framework) code in SQL Server is a very powerful way of extending the built-in features and functionality. The .NET framework provides access …

Continue reading →

SQL Server Database Restore Utility

This script is a simple utility to allow users to restore SQL Server databases. It’s easier to use for non-DBAs and it provides a method of restoring databases when the management tools are not installed. It’s a good demonstration of a HTA application, but it’s not a intended as a replacement for …

Continue reading →

T-SQL Proper Case Function

This function converts a string to proper case. e.g. Convert this: A LONG TIME AGO IN A GALAXY FAR, FAR AWAY To this: A Long Time Ago In A Galaxy Far, Far Away Note: It might be better to do this in the application rather than the database and it could be better written as a CLR function. This is …

Continue reading →