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.
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:
- SQL SERVER Management Studio – Completion Time in Messages
- SQL SERVER Management Studio – Rebuild All Indexes on Table
- SQL SERVER – Check for Update in SSMS
- SQL SERVER – Performance Test – sqlcmd vs SSMS
- SQL SERVER – Displaying Smiley in SSMS – Emoji
Reference:Â Pinal Dave (https://blog.sqlauthority.com)
2 Comments. Leave new
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.
Thank you so, so much … it was very helpful.