Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About empty (not null) fields size.

Status
Not open for further replies.

nimapoggy

Programmer
Mar 4, 2002
34
FR
Hi !
I would like to know how SQL server manage empty text fields. I heard that empty fields (not Null), in some other databases, were considered as non empty fields. For exemple, if I have a 200 chars long text field that I leave empty in some records, the space needed to store 200 chars was locker. So a database containing a lot of empty fields in records can be as big as if all the fields were not empty.
What about SQL server ?
If it's true, is there other data types such as INT that preserve its size even if it's empty ?

Note : I know the null value, but I'm trying to analyse an old database and I need some exemples to make understand that it was not well made...
 
In SQL Server NULL simply means that the data has not been defined. If you have a column of say varchar(200) then the space occupied by that field is equal to the size of it's contents.

A column char(200) will occupy 200 bytes of storage regardless of the length of the contents.

I hope this helps.

William
Software Engineer
 
So, null is not a way to reduce database size in case of missing datas for such fields (char(200)) ?
Ok, so Thank you very much for your very usefull answer.
nico
 
No it isn't.

Sizing a database correctly (and optimally) is an 'art' in it's own right.

:)

William
Software Engineer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top