"String or binary data would be truncated" error when executing an SQL SmartObject
kbt181534
PRODUCTIssue
When executing a SmartObject based off a SQL stored procedure or table, the following error is thrown:
An error has occurred: String or binary data would be truncated.
Symptoms
This error will be returned when executing a List method on the SmartObject in K2 Management and via the SmartObject Tester tool. When you run a Select statement with the same inputs directly in SQL, it will execute as expected.
Troubleshooting Steps
Verify that all the values returned in the SQL query are valid K2 datatypes. This error can occur when returning a value of type VarBinary, which is unsupported in K2. Please note that SQL functions such as Hashbytes return values of type VarBinary, so you will need to cast these to nvarchar if used in a stored procedure.