Connection string associated with an SSMS *.sql file

  • I have a project setup in SSMS with several *.sql files, each of which attempt to connect to an instance when they're opened. So, now we've shutdown several 2008 instances, but there's an attempt to connect to these instances each time I open some of these *.sql files. I don't see a connection string in the properties window, so, where is this connection information being stored?

    I don't mind dropping & recreating the files, & connecting to an existing database, I'm just curious where the connection string information is being maintained.

    Thanks,
    --=Chuck

  • chuck.forbes - Monday, July 3, 2017 2:40 PM

    I have a project setup in SSMS with several *.sql files, each of which attempt to connect to an instance when they're opened. So, now we've shutdown several 2008 instances, but there's an attempt to connect to these instances each time I open some of these *.sql files. I don't see a connection string in the properties window, so, where is this connection information being stored?

    I don't mind dropping & recreating the files, & connecting to an existing database, I'm just curious where the connection string information is being maintained.

    Thanks,
    --=Chuck

    I don't know for sure if SSMS 2016 stores any connection info per file, but I do know that opening a file connects to whatever server you're connected to and have that tab active at the moment.  There were some times when I would open a SQL file and it would ask to connect to the most-recently-connected-to SQL Server.  I found it to be a complete annoyance.  Thankfully, restarting SSMS cleared the issue.

  • Yeah, in this case it's just remembering this old instance. It's been happening for about the last year. I just got curious today, I suppose. I've opened the same file about 20 times since that server became unavailable.

  • chuck.forbes - Monday, July 3, 2017 3:03 PM

    Yeah, in this case it's just remembering this old instance. It's been happening for about the last year. I just got curious today, I suppose. I've opened the same file about 20 times since that server became unavailable.

    I've had SSMS remember connections for a long time, too.  I have an old SQL 2005 instance that it still remembers. :crazy:

  • chuck.forbes - Monday, July 3, 2017 2:40 PM

    I have a project setup in SSMS with several *.sql files, each of which attempt to connect to an instance when they're opened. So, now we've shutdown several 2008 instances, but there's an attempt to connect to these instances each time I open some of these *.sql files. I don't see a connection string in the properties window, so, where is this connection information being stored?

    I don't mind dropping & recreating the files, & connecting to an existing database, I'm just curious where the connection string information is being maintained.

    Thanks,
    --=Chuck

    Open the project and then on the toolbar - View and then Solution Explorer. In Solution Explorer, there are folders for Connections, Queries and Miscellaneous. Check the Connections folder.

    Sue

  • Interesting. If you go into the Connections folder and remove those which are now invalid, the *.sql script at least goes straight to a connection screen upon opening. Before that, I just had to wait 10-15 seconds while it unsuccessfully attempted to get to the SQL Instance.
    --=cf

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply