Home All Groups Group Topic Archive Search About

default database for opening a .sql file?

Author
19 Dec 2006 3:18 PM
Adam J. Schaff
I am using SQL Server Management Studio. Whenever I open a .sql file, it
does 2 annoying things:
1) prompts me to connect, yet again.
2) sets the database drop down to master again.

The second one, in particular, is really annoying. Is there a way to change
the database that it connects to when I open a .sql file?

Note: setting the default database for the server worked for windows created
with "New Query" but not for opening .sql files.

Author
19 Dec 2006 3:23 PM
Adam J. Schaff
Heh, 2 seconds after posting I stumble across it. When it prompts me to
connect, there is an Options button. I clicked it and on the Connection
Properties tab it had the same "connect to database" dropdown that I used to
set the default for new query windows. Now whenever I open a .sql file it
goes to the right database.

Show quote
"Adam J. Schaff" <asch***@cascodev.com> wrote in message
news:%23dCE6D4IHHA.4928@TK2MSFTNGP06.phx.gbl...
>I am using SQL Server Management Studio. Whenever I open a .sql file, it
>does 2 annoying things:
> 1) prompts me to connect, yet again.
> 2) sets the database drop down to master again.
>
> The second one, in particular, is really annoying. Is there a way to
> change the database that it connects to when I open a .sql file?
>
> Note: setting the default database for the server worked for windows
> created with "New Query" but not for opening .sql files.
>
Author
19 Dec 2006 5:05 PM
Tibor Karaszi
Just be aware that the database you connect to isn't part of the .sql file. If you want to be in the
..sql file, just add USE dbname in the beginning of the file. Or, create a project including this
file and the database information is in the project file.

Show quote
"Adam J. Schaff" <asch***@cascodev.com> wrote in message
news:eaROZG4IHHA.2456@TK2MSFTNGP06.phx.gbl...
> Heh, 2 seconds after posting I stumble across it. When it prompts me to connect, there is an
> Options button. I clicked it and on the Connection Properties tab it had the same "connect to
> database" dropdown that I used to set the default for new query windows. Now whenever I open a
> .sql file it goes to the right database.
>
> "Adam J. Schaff" <asch***@cascodev.com> wrote in message
> news:%23dCE6D4IHHA.4928@TK2MSFTNGP06.phx.gbl...
>>I am using SQL Server Management Studio. Whenever I open a .sql file, it does 2 annoying things:
>> 1) prompts me to connect, yet again.
>> 2) sets the database drop down to master again.
>>
>> The second one, in particular, is really annoying. Is there a way to change the database that it
>> connects to when I open a .sql file?
>>
>> Note: setting the default database for the server worked for windows created with "New Query" but
>> not for opening .sql files.
>>
>
>
Author
20 Dec 2006 12:57 AM
Paul A. Mestemaker II [MSFT]
>I am using SQL Server Management Studio. Whenever I open a .sql file, it
>does 2 annoying things:
> 1) prompts me to connect, yet again.
SQL Server 2005 Service Pack 2 will fix this problem.  We just released a
December CTP that has this improvement and many more.

http://www.microsoft.com/downloads/details.aspx?FamilyID=d2da6579-d49c-4b25-8f8a-79d14145500d&DisplayLang=en

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

Show quote
"Adam J. Schaff" <asch***@cascodev.com> wrote in message
news:%23dCE6D4IHHA.4928@TK2MSFTNGP06.phx.gbl...
>I am using SQL Server Management Studio. Whenever I open a .sql file, it
>does 2 annoying things:
> 1) prompts me to connect, yet again.
> 2) sets the database drop down to master again.
>
> The second one, in particular, is really annoying. Is there a way to
> change the database that it connects to when I open a .sql file?
>
> Note: setting the default database for the server worked for windows
> created with "New Query" but not for opening .sql files.
>

AddThis Social Bookmark Button