You are here

sql server

SQL Server - Getting All SQL Services Running On System

Getting all services running SQL Server using T-SQL:

PowerShell - Getting All Running SQL Services

Getting all SQL Server services running on a server using PowerShell:

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.

Finding Active Node in SQL Server Cluster

The T-SQL method to find the active node that a SQL service is running on:

SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') as ActiveNode

SQL Jobs – Daylight Savings Risks

For those of us not lucky enough to live in Arizona (where daylight savings is ignored and clocks stay the same all year-round), we need to consider what time our SQL jobs are run. What happens with jobs that are scheduled for 2:30am when we spring the clocks ahead? They are skipped! What happens to jobs scheduled for 1:30am when the clocks fall behind? They are run twice.


Validate SQL Code Without Running It

Validate SQL Code Without Running It

In a nutshell:

-- The script now will throw all DML errors without executing the code being run.

SSMS Scripting Partition Scheme With Correct Filegroup

I almost found a bug… but it’s a feature after all.

If you are scripting out a Partition Scheme in SSMS, you might notice that your script defaults to the PRIMARY filegroup. For the reason why, go here:

AdventureWorksDW Databases – 2012, 2008R2 and 2008

AdventureWorks sample databases seem to be so hard to find when you want them.  Here’s a link.

http://AdventureWorksDW Databases – 2012, 2008R2 and 2008


This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
9 + 6 =
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