Search code examples
sql-serverasp.net-mvcentity-framework

String or binary data would be truncated. The statement has been terminated. System.Data.SqlClient.SqlException (0x80131904)


String or binary data would be truncated. The statement has been terminated.

System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated


Solution

  • This exception throws when C#(model) try to save data record for column whose size defined less in SQL SERVER database table where value to pass to this column string length in greater.

    To fix this error you only need to alter column of table in SQL SERVER database using SQL Server script.

    Only increasing size of column in table works. No need to re deploy the application on PROD/TEST environment.