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

  • 15 February 2022
  • 0 replies
  • 161 views

Userlevel 5
Badge +20
 

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

kbt181534

PRODUCT
K2 Cloud
K2 Five
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.

Issue

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.


0 replies

Be the first to reply!

Reply