Take the 2-minute tour ×
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. It's 100% free, no registration required.

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 stackoverflow.com Aug 24 '12 at 12:19

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

add comment

2 Answers 2

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
show 1 more comment

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
add comment

Your Answer

 
discard

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.