17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The second provides specifics about the various files that make up your database — including their<br />

current size and growth settings:<br />

Name Fileid Filename Filegroup<br />

Accounting 1 C:\<br />

Program<br />

Files\<br />

<strong>Microsoft</strong><br />

<strong>SQL</strong> <strong>Server</strong><br />

\MS<strong>SQL</strong>10<br />

.MS<strong>SQL</strong>SERVER<br />

\MS<strong>SQL</strong>\DATA<br />

\Accounting-<br />

Data.mdf<br />

AccountingLog 2 C:\Program<br />

Files\<br />

<strong>Microsoft</strong><br />

<strong>SQL</strong> <strong>Server</strong><br />

\MS<strong>SQL</strong>10<br />

.MS<strong>SQL</strong>SERVER<br />

\MS<strong>SQL</strong>\DATA<br />

\Accounting-<br />

Log.ldf<br />

After you create tables and insert data, the database will begin to automatically grow on an as-needed<br />

basis.<br />

CREATE TABLE<br />

The first part of creating a table is pretty much the same as creating any object — remember that line I<br />

showed you? Well, here it is again:<br />

CREATE <br />

Since a table is what you want, we can be more specific:<br />

CREATE TABLE Customers<br />

Chapter 5: Creating and Altering Tables<br />

PRIMARY 10240<br />

KB<br />

NULL 5120<br />

KB<br />

Size Maxsize Growth Usage<br />

51200<br />

KB<br />

25600<br />

KB<br />

5120<br />

KB<br />

5120<br />

KB<br />

data<br />

only<br />

log<br />

only<br />

With CREATE DATABASE, we could have stopped with just these first three keywords, and it would have<br />

built the database based on the guidelines established in the model database. With tables however, there<br />

123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!