SQL SERVER – Open SSMS from Command Prompt

Some questions never get old when working with SQL Server and recently one of my clients of Comprehensive Database Performance Health Check asked me if I know any way to open SSMS via Command Prompt. Of course, it is possible to do that in Windows.

SQL SERVER - Open SSMS from Command Prompt openSSMS-800x185

You can always open SSMS via the command prompt, the matter of fact, I have created a short-cut on my machine where when I click on it they directly open a particular database with specific credentials. Before we continue, I must say that you should be very careful to save your credentials in your local box if someone gets hold of it, your security may be compromised.

Now here is how you can open SQL Server Management Studio (SSMS) via command prompt.

On command prompt type following to open SSMS:

SSMS.exe

If you are using windows for authentication, you can use the following command to log in to your SSMS:

SSMS.exe -E

Here is the command you can use it to connect to your specific database instance with window authentication:

SSMS.exe -E -S SQLServer2019

You can also directly connect to your specific database using the following command:

SSMS.exe -E -S SQLServer2019 -d MyDatabase

If you have to specify a username, you can use the following command:

SSMS.exe -U MyUserName -S SQLServer2019 -d MyDatabase

Please note that you have to enter your password in the SSMS window.

My command observation is that my DBA friends do not like the splash window of SSMS and you can also hide that by running the following command:

SSMS.exe -E -S SQLServer2019 -d MyDatabase -nosplash

There are few more options a swell but the option specified today is mostly used by my DBAs friend. If you are using any other command prompt shortcuts to open SSMS, do leave a comment. I will be happy to publish on the blog with due credit to you.

Here is a relevant blog post on this topic:

 

Reference: Pinal Dave (https://blog.sqlauthority.com)

Command Line, SQL Command, SQL Server Management Studio, SSMS
Previous Post
Azure Data Studio – Explain SQL Server Execution Plan
Next Post
SQL SERVER – User Statistics Report for Database – SSMS

Related Posts

2 Comments. Leave new

  • Christian de Bellefeuille
    December 9, 2020 3:49 am

    Well, i’m using v18 and every time i try this command, it try to login BEFORE asking my password which is extremly annoying. At least before, we had a -P parameter to provide the password.

    Reply
  • Thank you so, so much … it was very helpful.

    Reply

Leave a Reply