Create A Database: Before You Begin
Create A Database: Before You Begin
APPLIES TO: SQL Server Azure SQL Database Azure Synapse Analytics
(SQL DW) Parallel Data Warehouse
This topic describes how to create a database in SQL Server 2019 (15.x) by using
SQL Server Management Studio or Transact-SQL.
Note
In This Topic
Prerequisites
Recommendations
Security
Transact-SQL
Security
Permissions
Note
6. To change the default values of the primary data and transaction log files, in
the Database files grid, click the appropriate cell and enter the new value. For
more information, see Add Data or Log Files to a Database.
7. To change the collation of the database, select the Options page, and then
select a collation from the list.
8. To change the recovery model, select the Options page and select a
recovery model from the list.
9. To change database options, select the Options page, and then modify the
database options. For a description of each option, see ALTER DATABASE SET
Options (Transact-SQL).
10. To add a new filegroup, click the Filegroups page. Click Add and then enter
the values for the filegroup.
11. To add an extended property to the database, select the Extended
Properties page.
1. In the Name column, enter a name for the extended property.
2. In the Value column, enter the extended property text. For example,
enter one or more statements that describe the database.
12. To create the database, click OK.
Using Transact-SQL
To create a database
SQLCopy
USE master ;
GO
CREATE DATABASE Sales
ON
( NAME = Sales_dat,
FILENAME = 'C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\saledat.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = Sales_log,
FILENAME = 'C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\salelog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB ) ;
GO
See Also
Database Files and Filegroups
Database Detach and Attach (SQL Server)
ALTER DATABASE (Transact-SQL)
Add Data or Log Files to a Database