WhiskerBiscuit
WhiskerBiscuit

Reputation: 5157

How do you create an Azure database from the pre-canned SQL script in Management Studio 2016?

I've logged into my Azure account in SSMS 2016 and I want to create a Database named Foobar (I also want that DB to appear in the new Azure portal). If I right click Databases and select *New Database..." it presents to me a script.

--Comments from script removed

CREATE DATABASE <Database_Name, sysname, Database_Name> COLLATE <collation_Name, sysname, SQL_Latin1_General_CP1_CI_AS> 
    (
      EDITION = '<EDITION, , Standard>',
      SERVICE_OBJECTIVE='<SERVICE_OBJECTIVE,,S0>',
      MAXSIZE = <MAX_SIZE,,1024 GB>
    )

GO

How would I modify that for Foobar and Tier S0? I'm not sure what to do about sysname and other parameters in this script. I've done a simple Create database Foobar which DOES create a database, but it is not appearing iuin the Azure console.

Upvotes: 0

Views: 534

Answers (1)

Dan Rediske
Dan Rediske

Reputation: 852

I connected to my server and ran the following query against the master db

CREATE DATABASE [Foobar] 
COLLATE SQL_Latin1_General_CP1_CI_AS
    (
      EDITION = 'Standard',
      SERVICE_OBJECTIVE='S0',
      MAXSIZE = 250 GB
    )

   GO

And it created a database 'Foobar' of Tier 'S0' on my database.

Reference the CREATE DATABASE command documentation for more details on the command.

EDIT: You may want to pay special attention to the Max_Size limits if you choose to include them in your create statement- going beyond the allowed Max_Size for your service objective will throw an error. (1024 GB, from your original code, would cause this problem at 'S0')

Upvotes: 2

Related Questions