Sunday, March 25, 2012

Changing the default database

I have a large number of databases on my localhost. Whenever I open up
Management Studio, there is one database that is selected by default
(under Available Databases). But this is not the database that I use
regularly. Everytime I run a query, I have to make sure that the
database is changed.
Is there a way to change the default database selected in the
Available Databases drop down?
ThanksHow do you open the query window? The exact steps for opening the query window determines what steps
you need to take to make this your default database.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"spdude" <sandeshmeda@.gmail.com> wrote in message
news:1178132157.841268.133800@.y80g2000hsf.googlegroups.com...
>I have a large number of databases on my localhost. Whenever I open up
> Management Studio, there is one database that is selected by default
> (under Available Databases). But this is not the database that I use
> regularly. Everytime I run a query, I have to make sure that the
> database is changed.
> Is there a way to change the default database selected in the
> Available Databases drop down?
> Thanks
>|||On May 2, 2:55 pm, spdude <sandeshm...@.gmail.com> wrote:
> I have a large number of databases on my localhost. Whenever I open up
> Management Studio, there is one database that is selected by default
> (under Available Databases). But this is not the database that I use
> regularly. Everytime I run a query, I have to make sure that the
> database is changed.
> Is there a way to change the default database selected in the
> Available Databases drop down?
> Thanks
Have you tried setting the default database for the login you use?|||Thanks for the replies.
How do I set the default database for the login?
I open the query window by clicking on the "New Query" button. I like
this method because its just one click away.
On May 2, 2:49 pm, tcappelle...@.gmail.com wrote:
> On May 2, 2:55 pm,spdude<sandeshm...@.gmail.com> wrote:
> > I have a large number of databases on my localhost. Whenever I open up
> > Management Studio, there is one database that is selected by default
> > (under Available Databases). But this is not the database that I use
> > regularly. Everytime I run a query, I have to make sure that the
> > database is changed.
> > Is there a way to change the default database selected in the
> > Available Databases drop down?
> > Thanks
> Have you tried setting the default database for the login you use?|||Look at sp_defaultdb in Books Online. You can also use:
ALTER LOGIN sa WITH DEFAULT_DATABASE = [master];
--
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"spdude" <sandeshmeda@.gmail.com> wrote in message
news:1178286625.150157.211740@.h2g2000hsg.googlegroups.com...
> Thanks for the replies.
> How do I set the default database for the login?
> I open the query window by clicking on the "New Query" button. I like
> this method because its just one click away.
> On May 2, 2:49 pm, tcappelle...@.gmail.com wrote:
>> On May 2, 2:55 pm,spdude<sandeshm...@.gmail.com> wrote:
>> > I have a large number of databases on my localhost. Whenever I open up
>> > Management Studio, there is one database that is selected by default
>> > (under Available Databases). But this is not the database that I use
>> > regularly. Everytime I run a query, I have to make sure that the
>> > database is changed.
>> > Is there a way to change the default database selected in the
>> > Available Databases drop down?
>> > Thanks
>> Have you tried setting the default database for the login you use?
>

No comments:

Post a Comment