Home Forums SQL Server 7,2000 SQL Server Agent Msg 8152, Sev 16: String or binary data would be truncated. [SQLSTATE 22001] RE: Msg 8152, Sev 16: String or binary data would be truncated. [SQLSTATE 22001]

  • If you don't care the data to be truncated, just turn the ANSI_WARINGS OFF, the data will be truncated to fit the row and no error no fuss everything will work fine. Here is what you can see the effect:

    CREATE TABLE #tst (t char(2))

    insert #tst values ('abc')

    Execute that you get the following error:

    Msg 8152, Level 16, State 14, Line 1

    String or binary data would be truncated.

    The statement has been terminated.

    Then run this:

    set ansi_warnings off

    insert #tst values ('abc')

    You will get this:

    (1 row(s) affected)