8
votes

(This is for an Azure SQL Database)

Just about every article says at the start to "connect to the master database" before creating a new DB.

I have connected to my Azure SQL Database server with SSMS 2014 with no problems. I see the master DB under System Databases. I right-click on Databases (this is above System Databases) in the tree on the LHS and click New Database...

The template query comments area says among other things "...connect to master..." which implies to me that I am not connected to the master.

I am obviously missing something very fundamental and obvious regarding basics.

Can someone please put me out of my misery :)

PS When I click "New Database..." when connected to my non-Azure SQL Server 2012 I get a GUI and I am able to create a DB no problem.

2

2 Answers

2
votes

You do not need to explicitly connect to master to create a database in Azure SQL DB. Please follow the steps here to create a database in Azure SQL DB.

https://azure.microsoft.com/en-us/documentation/articles/sql-database-get-started/

Also, can you please give me links to the articles that mention "Connect to master" so I can take a look and correct them if needed? Thanks.

1
votes

I believe you are referring to the below template. You are actually connected to the master database and this is just a template instructions. If you are in doubt query select db_name() This should return 'master' for the master database.

If your connection string either specified database name as master / nothing it will be connected to master database.

-- ==========================================================================================================

-- Create database template for Azure SQL Database

-- This script will only run in the context of the master database. To manage this database in -- SQL Server Management Studio, either connect to the created database, or connect to master.