Home > Management Studio, SQLServer, SQLServer 2005, SQLServer 2008, SQLServer 2008 R2 > Management Studio Startup Parameters – Tips & Tricks

Management Studio Startup Parameters – Tips & Tricks


What do we do when we open SQL Server Management Studio? 99% of the time we connect to the server! ?

image 

This can be automated using the command-line options available for management studio. You can see full list of available command-line options, go to Start > Run > type “SSMS /?”:

image 

This will display the all available options which can be used with SSMS,

image 

The options are self-explanatory, the -E is used for Windows Authentication. – U, – S are used for SQL Server Authentication Both should be mutually exclusive. if you used together the SQL Server Authentication will take precedence. for example, to connect to default instance of local SQL Server execute below from Start > Run or from CMD.

SSMS S (local) –E
— connect to default instance using Windows Authentication

SSMS S (local)InstanceName –E
— connect to named instance using Windows Authentication

SSMS S (local) U sa P P@$$w0rD
— connect to default instance using SQL Server Authentication

SSMS S (local) E U sa P P@$$w0rD
— connect to default instance using SQL Server Authentication
— SQL Server Authentication takes precedence

SSMS S (local) E C:MyQuery.sql
— connect to default instance using Windows Authentication
— and open a saved query file

SSMS S (local) d AdventureWorks2008R2 E
— connect to default instance using Windows Authentication
— and change context to AdventureWorks2008R2 database

All the options described above are for SQL Server 2008. The same options can be used with SQL Server 2005. However, for SQL Server 2005, replace SSMS.exe with SqlWb.exe.

Hope This Helps!

Vishal

  1. Vinit
    21.08.2011 01:15 | #1

    Hey Vishal,
    Great post, I have question, I’m trying to connect to the sql servers through command prompt.
    let say I want to connect to “analysis” DB on the analysis server in SSMS through command prompt, there is no way how I can specify the server type in SSMS.exe parameters.
    Please suggest me how can I open Analysis DB in SSMS through command prompt, since it aalways opens the database engine ?

  2. Vishal
    22.08.2011 09:01 | #2

    AFAIK, command-line options only support connecting to Database Engine.

  1. No trackbacks yet.