Skip to main content
Inspiring
December 11, 2009
Answered

VARCHAR(MAX) Sql Server 2008

  • December 11, 2009
  • 1 reply
  • 1779 views

What is the maximum bite number you should use in VARCHAR before resorting to VARCHAR(MAX)? For instance, is it efficient to use VARCHAR(900) or VARCHAR(2500)? At what point is it most efficient to use the MAX?

This topic has been closed for replies.
Correct answer Dan_Bracuk

Microsoft says:

If you have sites that support multiple languages, consider using the Unicode nchar or nvarchar data types to minimize character conversion issues. If you use char or varchar, we recommend the following:

  • Use char when the sizes of the column data entries are consistent.
  • Use varchar when the sizes of the column data entries vary considerably.
  • Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.

1 reply

Dan_BracukCorrect answer
Inspiring
December 12, 2009

Microsoft says:

If you have sites that support multiple languages, consider using the Unicode nchar or nvarchar data types to minimize character conversion issues. If you use char or varchar, we recommend the following:

  • Use char when the sizes of the column data entries are consistent.
  • Use varchar when the sizes of the column data entries vary considerably.
  • Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.
Inspiring
December 17, 2009

Thank you for your response in regards to this. It helps alot when it comes to optimizing my database.

One other question that maybe you can help me with: What are the optimum VARCHAR values to use?

In other words, should the value be in blocks of 32 to be most efficient?   VARCHAR(32)  instead of VARCHAR(25), VARCHAR(64) instead of VARCHAR(50), etc....

Inspiring
December 17, 2009

The short answer is, "as small as you can make it while still meeting the requirements of the field".  The long answer depends on a variety of other things.