Creating Databases with T-SQL

Creating databases with Transact-SQL (T-SQL) is a bit more complicated. You will need to understand the syntax of the CREATE DATABASE statement before you begin. However, you can learn the syntax easily by using the GUI New Database interface that you used in Exercise 8.1 to set up the new database. Then, instead of clicking OK to create the database, as you did in step 9, you can click the Script button to generate a T-SQL script that would create the database for you. Figure 8.6 shows the Script button's options, and Figure 8.7 shows the very script that would be created for the Books database created in Exercise 8.1.

FIGURE 8.6 The Script button's options used to generate T-SQL scripts

FIGURE 8.7 The automatic ...

Get SQL Server® 2008 Administration: Real World Skills for MCITP Certification and Beyond now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.