Thursday, May 24, 2012

Exam 70-432: Week 1 Redux

This week's online forum posting comes from a question posted in the SQLServerCentral group on LinkedIn:
"I created a table with 4 fields (Col1 Int, Col2 Varchar(20), Col3 Varchar(20), Col4 Varchar(20)). without any rows. Does this empty table occupy space on the database?"

I thought a page might get allocated at table creation time, so I started looking. In Rod Colledge's book, SQL Server 2008 Administration in Action, I found the DBCC CHECKTABLE command and put it to good use:

use TK432
create table PageCheck (col1 int)
dbcc checktable ("PageCheck");

DBCC results for 'PageCheck'.
There are 0 rows in 0 pages for object "PageCheck".
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

So it looks like an empty table does not take up any space (except for the table definition).

If anyone disagrees, please speak up.

No comments:

Post a Comment