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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5: Creating and Altering Tables<br />

122<br />

GO<br />

MAXSIZE = 25MB,<br />

FILEGROWTH = 5MB);<br />

Now is a good time to start learning about some of the informational utilities that are available with <strong>SQL</strong><br />

<strong>Server</strong>. We saw sp_help in Chapter 4, but in this case, let’s try running a command called sp_helpdb.<br />

This one is especially tailored for database structure information, and often provides better information if<br />

we’re more interested in the database itself than the objects it contains. sp_helpdb takes one parameter —<br />

the database name:<br />

EXEC sp_helpdb ‘Accounting’<br />

This actually yields you two separate result sets. The first is based on the combined (data and log) information<br />

about your database:<br />

Name db_ size Owner dbid Created Status Compatibility_<br />

level<br />

Accounting 15.00 MB sa 9 May 28<br />

2005<br />

Status=ONLINE,<br />

Updateability=<br />

READ_WRITE,<br />

UserAccess=<br />

MULTI_USER,<br />

Recovery=FULL,<br />

Version=598,<br />

Collation=<br />

<strong>SQL</strong>_Latin1_<br />

General_CP1_<br />

CI_AS, <strong>SQL</strong>Sort-<br />

Order=52,<br />

IsAutoCreate-<br />

Statistics,<br />

IsAutoUpdate-<br />

Statistics,<br />

IsFullText-<br />

Enabled<br />

The actual values you receive for each of these fields may vary somewhat from mine. For example, the<br />

DBID value will vary depending on how many databases you’ve created and in what order you’ve created<br />

them. The various status messages will vary depending on what server options were in place at the time<br />

you created the database as well as any options you changed for the database along the way.<br />

Note that the db_size property is the total of the size of the database and the size of the log.<br />

90

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

Saved successfully!

Ooh no, something went wrong!