< class="prominent-subhead ">

"String or binary data would be truncated" error when executing an SQL SmartObject

This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.


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.


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.