Inserting data into a Microsoft SQL Server database using Java, I got an SQL truncation exception. But the exception doesn't show which column had the problem value.
Is there any way to find the error details, for instance from SQL Server Management Studio?
Note: I am using SQL Server database in Windows.
Unfortunately, no. The error message is as much information as SQL Server will give you.
To discover what values in what columns of which rows are at fault, you need to analyze the data. A common approach to discovering this sort of issue is to perform binary chops - remove half of the data or half of the columns, attempt the insert again (possibly into a temp table with the same structure as the real table) and see if the error recurs.
If it does, great, at least one problem is in the data that remains. If not, then you've eliminated half of the data as not causing a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With