sp_executesql giving truncate error

  • Hello Friends, i'm facing an truncation issue while creating statement for sp_executesql. Though I'm using nvarchar(max), its still giving me error.

  • Could the error be related to the actual statement sp_executesql is executing?

    Example:

    DECLARE @sql NVARCHAR(MAX)

    SET @sql = 'DECLARE @tbl TABLE (Test CHAR(1))'

    SET @sql = @sql + 'INSERT INTO @tbl VALUES (''ABCD...'')'

    EXEC sp_executesql @sql

    Generates:

    Msg 8152, Level 16, State 14, Line 1

    String or binary data would be truncated.

    The statement has been terminated.

    _____________________________________________________________________
    - Nate

    @nate_hughes

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

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