Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.
Another quick post, because this is something that’s annoyed me regularly. Hopefully writing this will help me make fewer mistakes.
Let’s suppose you have an Azure SQL Database. You go to connect from SSMS, as you do every day.
you log in, and you’re connected. But your default, by default, is master. This probably happens to you when connecting to many on-premise SQL instances. What do you do?
Most of us either click the drop down, which you can do, and even in Azure, you’ll see all your databases.
You can also enter a USE statement (which I do as I like the keyboard). However when you run that, you have an issue.
These databases, while they may be grouped on the same server for communications, do not necessarily reside on the same instance. Therefore you cannot ever assume you can change from one to the other with a USE. In fact, you need to actually change your connection.
The way to do that is to click “Options” on the connection dialog and then choose the second tab, Connection Properties.
Here you can specify the database to connect to. Once you do that, everything is great.
This took about 5 minutes to write. I changed my connection back to master, reshot the screens as I reconnected, and things worked.
You can do this. Show your next manager that you’re constantly working on your SQL Server skills.
No references here. This is something I should know well enough.