You probably access SQL Server Management Studio (SSMS) using an icon somewhere in your Start menu or on your desktop. But did you know that there are several command-line switches that you can use to start SSMS and end up right where you want to go?
Drop to a command-prompt and type this:
If the tools are in the system’s path variable, you’ll get a pop-up dialog explaining all of the options. Here they are, in case you’re reading this on a bus (like where I’m writing it!) – Note that case matters:
This is the name of the server instance you want to connect to. If you don’t put anything here you’ll start up in a disconnected window, which can be useful if you just want to edit some scripts.
This is the name of the database you want to connect to on the instance. If you don’t put anything here you will be dropped at the server itself.
This implies a trusted connection, so you don’t have to type a name and password if you’re using a Windows account to log in to SQL Server.
If you don’t use -E, this switch sets the user name for SQL Server authentication. Again, case counts here for the switch, not for the user name, unless your system is using a case-sensitive arrangement.
This switch sets the password. If you use –U, you have to use –P as well.
This is really cool – you can pass a filename to be opened when you start, such as a T-SQL script you want to edit or run. Note that there is no – here, just the path and name of the file.
Don’t like the splash screen that comes up when SSMS opens? Turn it off with this switch.
This switch just shows the options.