Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Varchar(MAX)

Author  Topic 

bpsintl
Posting Yak Master

132 Posts

Posted - 2009-03-18 : 05:02:48
I have some fields in the db that could possibly need to store large data, and also small.

If I use Varchar(MAX), would that cause excessive size in the db or will those fields only be large if you store loads in them?

I'm trying to work out whether or not to use MAX or a number such as 2000 etc?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-18 : 05:21:07
No, it will not. SQL Server will handle that for you automatically.
As long as the data is less than 8k, the data is stored "in-page". When the data is larger than 8k, the data is stored "off-page" and the content in table is replaces with a pointer to the data instead.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

bpsintl
Posting Yak Master

132 Posts

Posted - 2009-03-18 : 05:27:56
Great, I kind of suspected that but needed confirmation. Thanks!
Go to Top of Page
   

- Advertisement -