From the course: SQL Server 2008 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Changing the default database

Changing the default database - SQL Server Tutorial

From the course: SQL Server 2008 Essential Training

Start my 1-month free trial

Changing the default database

When you first begin working with SQL Server Management Studio, a lot of people do write queries. That's how they're getting to grips with the database and with SQL. Some folks can get a little frustrated by the fact that when you reopen Management Studio and click New Query, you will find this drop-down list of the default database often shifts back to whatever it was. Meaning that you have to remember to change it or to write the word USE AdventureWorksLT for example, or to include the name of the database in your SQL statement. And that can be a little annoying. Now what a lot of people try and do is they say, okay, if it keeps coming up with master or a different database, they go and look in say Tools > Options and they try and find some setting in SQL Server Management Studio where this is controlled. And they won't find one. So sometimes they give up and say, well, it's always going to be master or it's always going to be a particular database. Well, really, this setting has…

Contents