In Microsoft SQL Server 2008 R2 (RTM)-10.50.1600.1 (X64), if you specify a condition of 8001 bytes in the Like statement for a column declared with nvarchar or varchar, the following error appears.

Message 8152, level 16, status 10, line 3
String data or binary data is truncated.

Are you aware of the causes and reasons for this? By the way, if you specify it not equal to Like but no error will occur.

* Although this kind of processing does not actually occur, this is a question that emerged when examining test patterns.

  • Answer # 1

    I'm sorry. I got advice within my team and resolved myself (immediately ...)

    There was a description in the description of the Like statement on the Microsoft SQL Server page.

    A specific string to search for in
    match_expression, which can contain the following valid wildcard characters:
    The pattern can be up to 8,000 bytes.

    The site is here → LIKE (Transact-SQL)