SQL Server : CREATE DATABASE

Here is a simple example of creating a database in SQL Server.

USER master;
GO

CREATE DATABASE MyDatabase
  ON (
        Name = N'MyDatabase',
        FileName = N'e:\db\MyDatabase.mdf',
        Size = 10MB,
        maxsize = unlimited,
        filegrowth = 1GB
      )
  LOG ON
      (
        Name = N'MyDatabaseLog',
        FileName = N't:\tl\MyDatabase.ldf',
        Size = 10MB,
        maxsize = unlimited,
        filegrowth = 1GB
      )

You will typically see sizes referenced in units of KB, MB, GB or TB.

You can drop a database using the following type of command.

DROP DATABASE MyDatabase

For more information see: