in

The SoftTeq Community Site

SoftTeq blogs

Alastair Waddell

December 2008 - Posts

  • Updating a column greater than 4000 characters

    I was asked to help with an issue where the user was trying to update a column with a large amount of text. It was only inserting the first 4000 characters

    The table has a column - nvarchar(MAX) and they were using SQL Management studio.

    The solution was to

    DECLARE @string1 nvarchar(MAX)
    DECLARE @string2 nvarchar(MAX)
    SET @string1 = 'SOME TEXT less than 4000 chars'
    SET @string2 = 'The rest of the TEXT'

    Update table
    Set TheColumn = @string1 + @string2

    It looks as if even though the declaration of the variable is nvarchar(MAX) it is actually nvarchar(4000) .

More Posts
Copyright SoftTeq 2007-2009
Powered by Community Server (Non-Commercial Edition), by Telligent Systems