SQL 2005 max variable size 4k

  • I've read SQL 2005 now has a max variable size of 8k, but ours is still at 4k. Is there a setting somewhere that can easily be changed or was it an install option?

    Thanks, Ed

  • Where do you get this information from?

    This little test shows that a variable can hold more than 4K

    DECLARE @var char(8000)

    SET @var = (SELECT REPLICATE('Test',2000))

    SELECT @var

    Markus

    [font="Verdana"]Markus Bohse[/font]

  • NVARCHAR is still 4000 bytes due to being double byte character sting (unicode).


    N 56°04'39.16"
    E 12°55'05.25"

  • Peter Larsson (11/7/2007)


    NVARCHAR is still 4000 bytes due to being double byte character sting (unicode).

    Sorry Peter to correct you but nvarchar too is 8000 bytes, but the length is limited to 4000 because of the double byte character.

    [font="Verdana"]Markus Bohse[/font]

  • MarkusB (11/7/2007)


    Peter Larsson (11/7/2007)


    NVARCHAR is still 4000 bytes due to being double byte character sting (unicode).

    Sorry Peter to correct you but nvarchar too is 8000 bytes, but the length is limited to 4000 because of the double byte character.

    Semantics 😀


    N 56°04'39.16"
    E 12°55'05.25"

  • ed.nettestad (11/6/2007)


    I've read SQL 2005 now has a max variable size of 8k, but ours is still at 4k. Is there a setting somewhere that can easily be changed or was it an install option?

    Thanks, Ed

    If you use VARCHAR(MAX), you get 2 gig.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thanks for the help, Ed

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply