Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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 not a lot to do with SQL Server Management Studio and more to do with how you are logged on to this database instance, because every user has their own identity in SQL Server.
If I expand the Security folder, the one right of the top here, I am going to expand Logins and find myself listed here. This is all the information about me as a user logged on to SQL Server. I right-click and select Properties. What I will find is that I have a default database. And what's happening is Management Studio is just reading my settings. What I need to do is change this to, for example, AdventureWorksLT, click OK, and now if I close down Management Studio and a little later or the next day I reopen it, I connect to that instance, and I say I want to make a new query, it's going to read my data, say what is your default database, and that's what will show up in this drop-down list.
So, you might find that convenient from time to time. Though do bear in mind that every different user has a different default database and if somebody else has a different one from you, you might not necessarily just be able to copy and paste them SQL in an email and have it work. But this makes it a bit more convenient than remembering to type the name of the database all the time in your SQL.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 91066 Viewers
80 Video lessons · 138143 Viewers
59 Video lessons · 56953 Viewers
52 Video lessons · 70582 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.