Friday, March 9, 2012

q; varchar(MAX)

varchar(MAX)
Is there any advantage/disadvantage using varchar(MAX) instead of
varchar(1000)Jim,
No technical disadvantage, but it makes your intent less clear. Datatypes
should ideally indicate the intent of the data. (Rather like someone just
making everything VARCHAR, rather than INT, DATETIME, etc.)
Of course, if you actually go beyond the 8K page boundary in the amount of
data, then there is a natural impact on performance for the extra I/O
involved with the large datatype.
RLF
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:910C5A5C-7376-4EB1-BF67-7ECE7C26E10E@.microsoft.com...
> varchar(MAX)
> Is there any advantage/disadvantage using varchar(MAX) instead of
> varchar(1000)
>|||On Fri, 28 Sep 2007 04:36:00 -0700, JIM.H.
<JIMH@.discussions.microsoft.com> wrote:
>varchar(MAX)
>Is there any advantage/disadvantage using varchar(MAX) instead of
>varchar(1000)
VARCHAR(MAX) is a wonderful new feature when used correctly.
If your data should not be longer than 1000 characters, and your
programs and reports are written to only handle 1000 characters, then
the major disadvantage to varchar(max) is that you could end up with
data in the table that the code can not handle. There is also some
overhead to handling varchar(max) that is avoided with varchar(1000),
though not much if you keep the data short enough that the (max) was
not needed.
And using varchar(max) when it is not needed is just plain sloppy. To
me it says someone couldn't be bothered to set the length correctly.
The next person who comes along may not realize that there is an
implicit limit. Or they will know there must be one, but not be able
to find what it is.
Roy Harvey
Beacon Falls, CT|||In addition to the other responses, there is an advantage to keep the
defined size below 800 bytes, because values of more than 800 bytes
cannot be indexed or grouped.
--
Gert-Jan
JIM.H. wrote:
> varchar(MAX)
> Is there any advantage/disadvantage using varchar(MAX) instead of
> varchar(1000)

No comments:

Post a Comment