Command prompt shortcut to open a Microsoft SQL Server database directly

You might have started looking for a shortcut if you have been using Microsoft SQL Server for a long time. Once you have many databases in Microsoft SQL Server Management Studio, it becomes quite cumbersome to navigate through lists to find the database you want to work with.

There is an easier way to connect your favorite database and start sending queries right away. Simply use the following command. It will open Microsoft SQL Server with your database automatically connected.

ssms.exe -S serverIP -d databaseName-E - U userName-P password

Check out the parameters below if you want to customize this query further:

ssms.exe [-S server_name[\instance_name]] [-d database] [-U user] [-P password] [-E] [-G] [-nosplash] [file_name[, file_name]*] [-log [file_name]?] [-?]

[-S The name of the SQL Server instance to connect to]
[-d The name of the SQL Server database to connect to]
[-E] Use Windows Authentication to login to SQL Server
[-U The name of the SQL Server login to connect with]
[-P The password associated with the login]
[-G] Use Azure Active Directory for authentication
[-nosplash] Suppress splash screen
[file_name[, file_name]*] Names of files to load
[-log [file_name]?] Logs SQL Server Management Studio activity to the specified file for troubleshooting
[-?] Displays this usage information

 

Leave a Reply