How can Get 10,000 characters in a string varaible

  • Hi

    I am using nvarchar(MAX) string variable. But its length is maximum upto 8,000 charaters. But I want to assign 10,000 characters. So how can I get this.

    Thanks

  • > ...But its length is maximum upto 8,000 charaters

    nvarchar(max) can hold over 1,000,000,000 Unicode (double-byte) characters.

    If you're having trouble getting all of your data into the variable, be sure you're converting it to the proper type (nvarchar(max)) first.

    DECLARE

    @blah nvarchar(max)

    SELECT @blah = replicate(convert(nvarchar(max), N'0123456789ABCDEF'), 50000)

    SELECT len(@blah)

    Results:

    BlahLen

    --------

    800000

    -Eddie

    Eddie Wuerch
    MCM: SQL

Viewing 2 posts - 1 through 1 (of 1 total)

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