In this post i will write about how to switch between different SQL Servers within a query window in SSMS or in another words i can say how to run a T-SQL command from the same window at different sql servers in SSMS.
Let us consider the following image. If i put my mouse over the query window tab of SSMS, it will give me a tooltip that i am connected currently to the master database of the Test server. This is highlighted in the red block.
After executing the SQL script at Test Server, i want to run the same command at Production Server .Therefore i need to switch the server from Test to Production. So i will use the same query window to run the same T-SQL command in SSMS.
Click on the change connection in SSMS as highlighted in the red block. When you put your mouse over the icon highlighted in the red block, a tooltip as “Change Connection” will also appear as shown below.
After that Connect to the Database Engine will appear. Mention the SQL Server Name with which you want to connect with appropriate Authentication mode. In my case i am using Window Authentication and connecting to Production Server as shown below. After that hit connect.
Now if i put my mouse over the query window tab of SSMS, it will give me a tooltip representing that i am connected currently to the master database of the Production Server. This is highlighted in the red block as shown in the following image.
In this way you can switch between different SQL Servers within a query window in SSMS.
One thought on “How to switch between different SQL Servers within a query window in SSMS”
Thanks Raghav for liking the post