How to connect once for all queries in SQL Server Management Studio?

WePython 1 Months+

SSMS asks me to connect for every query in my project. Is there a way to connect only once per connection for all of the queries using it in my project?

-----------------Answer-----------------

It has nothing to do with the Remember password option. It is just easier to reconnect when this option is checked because you only have to hit .

You have to go to this menu in SSMS: Tools / Options

In the Options window, go to this node:

  • Query Execution
  • SQL Server
  • Advanced

At the bottom, uncheck Disconnect after the query executes:

It won't change a thing on existing connection and already opened query windows.

Open a new New Query window and connect to your server. It should not request login and password or AD user anymore, or just once.

-----------------Answer-----------------

Click View --> Registered Servers Right-click Local Server Groups --> New Server Registration

Then you can store the connection info, name it what you want, and just double-click then when you want to use it.

-----------------Answer-----------------

Do you have a connection configured for your project within SSMS?

If not right-click under Connections and create a new connection to your instance. Then to create a new query simply right click the connection you created and select "new query". It will then use that connect for your query.

It is by design it does this because the query you create has to be associated to some connection, which clicking cancel will obviously create the query with no connection.


Previous : Reason to not use nullable number in Oracle?
Next : Why would you want to avoid dynamic SQL in stored procedures?