You are here

SQL Server

PowerShell - Update All SQL Services To Restart On Failure

PowerShell script to quickly change all Recovery Options to "Restart the Service".

T-SQL - Get Listener Name on AlwaysOn Cluster

When using AlwaysOn, you must connect using your listener name, not your node name.  If you connect with the node name, it will only work until there is a failover, which would defeat the purpose of your High Availability setup, right?

SQL Server - Timestamp Column

While this seems like a simple thing to do, I recently discovered so many ways not to do it (also known as failing) that I just had to document this one.

T-SQL - Get Currently Running Jobs With Duration

Query to get all currently running jobs with their run duration in seconds.


SQL Server - Database Stuck In Single User Mode

If you've painted yourself into the single_user corner, here is how you can get out.

SQL Server - Cluster Queries

Get some clustered facts about your server.

SQL Server - Getting All SQL Services Running On System

Getting all services running SQL Server using T-SQL:

SQL Server - All Objects On Instance Sorted By Date

One common question I hear whenever something begins to go wrong is, "Has anything been changed recently?" Finding recent changes can be a good place to search, depending on the issue, so here is a script to do just that.

Moving Database Files to Another Location

Although moving database files around is simple, it is a still big deal.  When you do this, you are moving the entire database contents to another location.  If you have the space, a backup beforehand wouldn’t be a bad idea.  This is the script that I use to make this happen.

SQL Server Compare Users Script

If you need to compare two users in SQL Server, here is a handy script. The output is simply a script to make the “UserToChange” sync up with the “ModelUser”. So this script generates a script.


This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
15 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer