tags:

views:

248

answers:

3

I have a SQL Server 2005 database and I have 4 GB of text files that I need to import into it. The question is, if these 4 GB of text files are 1.2 GB when they are zipped, how big would the database be if they are imported? Does SQL Server shrink data by default, or how would I set this (think create a database as a detached item, to be attached to another DB later).

+4  A: 

SQL Server will not shrink data by default. In fact, there will be a small overhead per column and row, so it would require more space.

If you really must store those files in the DB (it is recommended that you don't), take a look at this article I blogged a while back. In SQL Server 2008, they have introduced the FILESTREAM type.

Mitch Wheat
Nice post on the filestream!
edosoft
it seems the link is dead ...
Philippe Grondier
just tried it and it worked for me.
Mitch Wheat
A: 

There is no automatic compression - although you could put compressed data in columns it will be difficult to search.

Are these being imported into a set of normalized tables? Are there spaces or other data which will be stripped (commas)?

If so, you can expect space savings from the normalization and the trimming of spaces.

Cade Roux
+1  A: 

There are two primary factors:

  • Indexing will increase the space requirement.
  • Normalization will decrease the space requirement.
David B