We have a webapp that uses hibernate to store data in an instance of sql server 2005.
Sometimes we get a com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
While we can get the insert request and then manually compare with the definition of the column in the database to see which column is too small, it is slow and error prone. Is there a way to automatically get a table / column that has a problem from this exception?
I searched Google and SO for a solution, so I understand if the answer is “no, you can’t get this information”, but I decided it wasn’t painful to ask.
source share