Getting Microsoft SQL Server Management Studio to automatically log in to a server

Posted by Dan on Jan 19, 2009 @ 10:16 AM

I finally got tired enough of having to click the "Connect" button at SQL Server Management Studio startup, that I decided to look for a way to bypass this prompt. Since in development, I typically am only ever dealing with the same server, the connection dialog always added an extra step to the process of getting up and running.

So, a quick search on Google turned up a list of the following command prompt switches you can use to specify a server (and database) to use when starting up:

Usage:
sqlwb.exe [-S server_name[\instance_name]] [-d database] [-U user] [-P
password] [-E] [file_name[, file_name]] [/?]

[-S The name of the SQL Server instance to which to connect]
[-d The name of the SQL Server database to which to connect]
[-E] Use Windows Authentication to login to SQL Server
[-U The name of the SQL Server login with which to connect]
[-P The password associated with the login]
[file_name[, file_name]] names of files to load
[-nosplash] Supress splash screen
[/?] Displays this usage information

So, all you need to do to get SQL Server Management Studio to automatically log in to a specific server is to right-click on your SQL Server Management Studio icon, and change the "Target" to something like:

"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe" -S SERVERNAME -d DATABASENAME

SQL Server Management Studio Properties Box

Categories: SQL

3 Comments

  • This is a great idea Dan. I also like the -nosplash flag. I just tried this on my workstation and it logs in okay, but I do not get the db, tables, etc. listed in the Object Explorer. Is that expected or am I missing something?
  • According to the link below, not connecting to the Object Explorer is the expected behavior:

    http://groups.google.com/group/microsoft.public.sq...

    While I'd prefer that it did connect to the Object Explorer automatically, I can live with manually logging in to it since I don't always need the Object Explorer.
  • Hi,

    I tried downloading MS SQL Server management studio Express edition but it wont work. I think it has something to with me using Windows Vista. Any help would be greatly appreciated.

    Mark

Comments for this entry have been disabled.