O'Reilly logo

SQL Server 2014 Development Essentials by Basit A. Masood-Al-Farooq

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and modifying databases

You can use either Transact-SQL DDL statements or SQL Server Management Studio to create and modify databases. In the following subsections, we will discuss these options.

Create, modify, and drop databases with T-SQL DDL statements

In this section, we will cover Transact-SQL DDL statements that are used to create, alter and modify SQL Server databases.

Creating a database with T-SQL DDL statements

We use the CREATE DATABASE statement to create a new database on SQL Server. The general syntax for the CREATE DATABASE command is as follows:

CREATE DATABASE database_name [CONTAINMENT = {NONE | PARTIAL}] [ON [PRIMARY] [<filespec> [,...n] [,<filegroup> [,...n]] [LOG ON <filespec> [,...n]]] [COLLATE collation_name] [WITH ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required