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

If you like this post, do like my Facebook Page -> SqlAndMe
EMail me your questions -> Vishal@SqlAndMe.com
Follow me on Twitter -> @SqlAndMe

About these ads
  1. Vinit
    August 21, 2011 at 1:15 am

    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 :(

    • August 22, 2011 at 9:01 am

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

  1. July 28, 2011 at 9:16 am
  2. October 19, 2011 at 12:25 pm
  3. April 9, 2014 at 11:30 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 264 other followers

%d bloggers like this: