• 1. The "N" prefix indicates "National" characters, that is, double-byte characters to support large-alphabet languages such as Japanese.

    2. The concatenation of N'hello' to the repeated hyphens is where the first conversion to national characters happens.

    3. Although a variable defined as varchar(max) or nvarchar(max) may hold many more characters, without the "max", the largest size is 8000 bytes (4000 double-byte characters).

    4. The assignment of the concatenated string to @C converts the nvarchar data back to varchar, but it's already truncated at 4000 characters

    Try running the code with different values to see either the truncation in effect or parsing errors on the maximum size of a data type.

    Finishes with same output as original:

    declare @C varchar(7000)

    set @C = N'hello' + replicate('-',9000)

    print len(@c)

    print @C

    Max size error:

    declare @C varchar(9000)

    set @C = N'hello' + replicate('-',9000)

    print len(@c)

    print @C