SQL Server Error : String or binary data would be truncated

My table :

log_id                 bigint
old_value                  xml
new_value                  xml
module                 varchar(50)
reference_id           bigint
[transaction]          varchar(100)
transaction_status         varchar(10)
stack_trace                ntext
modified_on                datetime
modified_by                bigint

Insert Query :

  • Dynamically Pivot unknown Data
  • Is it possible to password protect an SQL server database?
  • How to combine a linq query dynamically?
  • Pyodbc installation error on Ubuntu 16.04 with Sql Server installed
  • Check for an specific id or value in multiple tables
  • SET OPTIONS…where are they stored
  • INSERT INTO [dbo].[audit_log]

    Error :

    Msg 8152, Level 16, State 14, Line 1
    String or binary data would be truncated.
    The statement has been terminated.

    Why is that ???

  • Split string and take last element
  • Basic template for Transactions in sqlserver
  • How to measure query duration without showing results of query?
  • Stored procedure
  • Does the order of tables referenced in the ON clause of the JOIN matter?
  • SQL query to convert columns into rows
  • 3 Solutions collect form web for “SQL Server Error : String or binary data would be truncated”

    transaction_status is a varchar(10) and you’re trying to store 19 characters to it.

    this type of error generally occurs when you have to put characters or values more than that you have specified in Database table like in this case:
    you specify
    transaction_status varchar(10)
    but you actually trying to store
    which contain 19 characters.
    that’s why you faced this type of error in this code..

    This error is usually encountered when inserting a record in a table where one of the columns is a VARCHAR or CHAR data type and the length of the value being inserted is longer than the length of the column.

    I am not satisfied how Microsoft decided to inform with this “dry” response message, without any point of where to look for the answer.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.