My Place

Simple thoughts

SQL Server Aliases

At work we have several hundred SQL server instances, about a month ago we moved from the reasonable DATACENTER+SERVERNUMBER\AGENCYNAME style to asdfhjasklsdfasdf, or some close approximation. After spending a few minutes dealing with this atrocity of having to type 31l1 and typing 311 about 5 times I decided there had to be a better way. I tried hosts and it worked BUT had problems with instances. So then I read about this little used program, cliconfg that lets you set a local alias.

So here is a start to setup such a thing on Win7 64 bit, I think 32 bit uses a different reg path, create a reg file and put this in that file putting as many aliases as you want one per line.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\SuperSocketNetLib]
"ProtocolOrder"="tcp"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\SuperSocketNetLib cp]
"DefaultPort"=dword:00000599

[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo]
"DEV"="DBMSSOCN,DEVSERVER\DEV"

After you do this you can just use DEV has an alias to point to a specific instance, I have shared it with coworkers and its been a big hit.