Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

The answers below (March 2014) don't answer the question. Still looking for a solution.

share|improve this question

migrated from Aug 24 '12 at 12:19

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

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 ENTER.

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:

enter image description here

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.

share|improve this 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.

share|improve this answer
Sorry, I read your question too quickly. What version of SSMS are you using? In SSMS 2012, I don't get this behavior. If I add a connection to the project, then right-click the connection and say "New Query", close and re-open the query, it opens without prompting for connection info. If you right-click the query and go to Properties, is the "Associated Connection" field filled in? – eequalsmcaputo Aug 22 '12 at 20:27
There's also this – eequalsmcaputo Aug 22 '12 at 20:28
No problem. I, too, am using SSMS 2012. And the "Associated Connection" field filled in with my connection. But every time I open a query (even if it has been opened and closed before in this session) - I'm asked to connect. Perhaps this doesn't happen to you because you told it to save the password? – ispiro Aug 22 '12 at 21:14
I now see that even when I tell it to "save password" - it still asks me to actually connect every time. (I'm connecting to a remote server, if that makes a difference.) – ispiro Aug 22 '12 at 21:19
OK, now I see what you're really asking - you only want to cache the password for each session without storing it permanently. Sorry, don't think that's possible. – eequalsmcaputo Aug 22 '12 at 21:20

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.

share|improve this answer
I already have a connection there, and it is that connection which all of my queries use. (Though I didn't create them like you said, rather by clicking the "New Query" button.) But every query I double-click to show it - asks to connect. – ispiro Aug 22 '12 at 19:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.