Examples for naming SQL Server Instances

This blog post is in response to a question / comment that to my blog posted earlier this week, if you haven’t read it, read it here Rules to follow while naming a SQL Server. I thought it would make sense when explained with examples instead of a short reply to that comment.

As with many things in IT, the simplest answer is “it depends”. So these examples that I am giving below are purely fictitious…

What to consider when naming the SQL Instance?

When naming a SQL Server Instance, I would consider the primary application that is going to use this SQL Server Instance, the location of the SQL Server and Environment the SQL Instance belongs to..

Let’s assume there is a Sales application and a SQL Server Instance in required for that application. The SQL Servers (QA, Dev and  Prod) are going to be deployed in New York, I would name the SQL Server Instances as SLSNYCQAS, SLSNYCDEV and SLSNYCPRD.

Another example where an organization named WhiteSun needs a SQL Instance for their Research & Development application, the SQL Instance names that I can think would be WSRNDSTG, WSRNDTRG, WSRNDTST, WSRNDDEV and WSRNDPRD. STG short code for Staging, TRG for Training, TST for Test etc.

There is no hard and fast rule that the Instance names should be ending with PRD, DEV and so on. These SQL Instance names mentioned above can be jumbled to make new names such as DEVSLSNYC or WSTSTRND as per the choice of the decision maker, be it a SQL Server DBA or a Project Manager..

Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru so that, you know when there is a new blog post.

— Bru Medishetty

Rules to follow while naming a SQL Server Instance

When planning to install SQL Server on a server, you need to plan ahead about the name of the SQL Server Instance. If you are installing a default instance then this is not necessary. There are certain rules you will have to follow when naming your SQL Instance and lets see what are some of the acceptable names and some non acceptable names for a SQL Server Instance.

Lets start with those names which are not accepted along with some examples….

Reserved Keywords in Microsoft SQL Server are not accepted. You cannot name a SQL Instance as DATABASE or ALTER or CREATE or SCHEMA (of course Capitals Letters does not matter). See the below pic when I try to name the SQL Instance as DATABASE..

First character should not be a numerical value (0-9), it can be an alphabet (a-z), underscore ‘_’, number sign ‘#’, or ampersand ‘&’. If you try naming a SQL Instance as ‘1SQLServer’, it would not allow you to name with that name. See pic below..

Space and special characters (such as @, ^, *, \ ) are not allowed. That is, if you try naming the instance as “SQL TEST 2”, it is not accepted.

Instance name should be 16 chars or less in length. This is pretty easy to understand, if you want to name the Instance too long, then you have to think again..

As long as they are less than 17 characters, some of the acceptable names can be..

  • SQLServer123
  • SQL_Server_123
  • SQL_Server#123
  • SQL$Server123
Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru so that, you know when there is a new blog post.

— Bru Medishetty