Create New Database in Azure Data Studio

CREATE DATABASE Statement.

How to create a blank new database:

  1. Start Azure Data Studio
  2. Right Click the “ localhost ” template. …
  3. Select  Manage Option. ..
  4. Click the New Query (under the Task).
Syntax:- 
-- Create a new database called 'DatabaseName'
-- Connect to the 'master' or Any database to run this snippet
USE master  
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
    SELECT [name]
        FROM sys.databases
        WHERE [name] = N'DatabaseName'
)
CREATE DATABASE DatabaseName
GO

Create New Database Using Adam Database. Adam Database is User Defined Database. Example : –

-- Create a new database called 'TestDB'  -- TestDB is database name
-- Connect to the 'Adam' database to run this snippet
USE Adam
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
    SELECT [name]
        FROM sys.databases
        WHERE [name] = N'TestDB'
)
CREATE DATABASE TestDB
GO

After Execution of the codes, Database Successfully Created.

I hope the the Post Helpful. If Any Doubt Leave Your Comments…

Post Author: adama