Monday, September 6, 2010

MSSQL why not always define varchar and nvarchar as max in length ...

Table storage wise, there is no difference in storage space used when a 4 char string is stored in varchar(10) or varchar(1000) ... it will use the same space on the disk (it stores the 4 char string plus 2 bytes for the length).

The only difference will be if there is an index built on the field, then the index space used for varchar(1000) will be larger than the index used for varchar(10).

No comments:

Post a Comment

Feel free to comment. No links/URLs allowed in comments.