Basic elements of a Transact-SQL statement, part 1
Objective
Use Transact-SQL to create a basic database..
Transact-SQL Statement
To create a database, use the Transact-SQL statement CREATE DATABASE. The only thing that is required along with the statement is a name for the database, such as "employee." You can create a database with all the default values using a Transact-SQL statement as simple as:
CREATE DATABASE employee
Without specifying any additional parameters, the following defaults are created:
The filename is employee_Data.MDF and it is located in the SQL Server data directory.
The initial size of the database is equal to the size of primary file in themodel database. If you have not changed this value since you installed SQL Server 7, the size is one megabyte.
The database size will grow automatically in 10% increments with no maximum.
The file location of the transaction log is employee_Log.LDF (in your SQL Server data directory).
The initial size of the transaction log is one megabyte.
The transaction log size will grow automatically in 10% increments with no maximum.
The series of images below reviews the available syntax for the CREATE DATABASE statement:
In the next lesson, we will take a look at control-of-flow logic, which enables you to test the value of a variable and take an action based on that value.