September 2010
Intermediate to advanced
1704 pages
111h 8m
English
Instead of using SSMS, you can use T-SQL to create a database. The T-SQL command to do this is CREATE DATABASE. The CREATE DATABASE syntax is extensive and is best illustrated with an example. Listing 23.1 shows a sample script to create a database called mydb. This script was generated using the Script option available on the New Database screen.
Listing 23.1 Using T-SQL to Create a Database

The database created in Listing 23.1 is relatively simple. It is named mydb and contains one data file and one log file. The data file is created on the PRIMARY filegroup; it is named mydb.mdf and is created in the C:\mssql2008\data ...
Read now
Unlock full access