How to create shortcut for SSMS and Connect to Default SQL Server Automatically - SQ: Server / TSQL Tutorial Part 4


You are working as SQL Server Developer with Car Insurance company as contractor. They have provided you name of SQL Server Instance and Database Name you will be working during your assignment. Every time you open SQL Server Management Studio, you have to provide Server Name and then choose Database Name to start work. You would like to create s shortcut for SSMS with default settings so you can connect to Database with one click.


Step 1:  Create SSMS Shortcut. 
Go to Search and type SSMS. Once see the SSMS, Right Click and choose Open file location.

How to create SSMS Shortcut - SQL Server Tutorial

One you choose Create Shortcut, it will ask you Do you want to create on Desktop. Click that and you are done.

How to create SSMS Shortcut - SQL Server Tutorial

Step 2: Change Shortcut Properties
As our shortcut is ready now. Go to Desktop and right click on SSMS Shortcut and then go to properties.

In Target, we are going to add some parameters to SSMS.exe. By default it is simply opening SSMS.exe. 
If I would like to open my default SQL Server Instance with Windows Authentication and user Database TestDB1, i can use below parameters

-s .  -E -d TestDB1

Parameter meansings
-s The name of the SQL Server Instance to connect to (after -s, I provided Dot(.) that means I would like to connect to my default SQL server Instance. I could have provided Named SQL Server Instance if want to.

-E User Windows Authentication to login to SQL Server.

If you would like to use User Name and password, you can use -U for user name and -P for password.

-d The name of the SQL Server Database to connect to.

How to connect to SQL Server with Single Click- SSMS Shortcut - SQL Server Tutorial

Hit apply. Now once you will open SSMS by using Shortcut, it will automatically connect to default SQL Server Instance and open Query with scope of TestDB1.

No comments:

Post a Comment