Home Dashboard Directory Help
Search

The "data was truncated" exception should specify TABLE and COLUMN names by Qnomad


Status: 

Closed
 as By Design Help for as By Design


5
0
Sign in
to vote
Type: Bug
ID: 587995
Opened: 8/21/2010 2:40:16 AM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

When the exception with message "The data was truncated while converting from one data type to another. [ Name of function(if known) = ]" is raised by SqlCe, having it report what column of what table the error occurred on can be useful. The information can be used for debugging, or to inform the user of invalid input. Inspecting the exception with the debugger, however, reveals this valuable information is not present.
Details
Sign in to post a comment.
Posted by mattcraig on 2/9/2011 at 6:56 AM
Strongly agree with PRMan99. I'm currently suffering from this problem in an app (and it's not my first encounter with it), and although I have gone through the code with a fine-tooth comb, it's still not clear what/where the problem is since it does not occur until a commit, which is not necessarly the same point as the problem insert.

I think just about any developer will agree that generic errors messages are not only of little use, but are extremely frustrating. If I knew what table/column was causing the problem, I'd be far more productive and have a few less grey hairs. Thanks.
Posted by PRMan99 on 1/22/2011 at 9:21 AM
If developers don't want this information going to their end-users, then they need to trap the error message appropriately. That takes a few minutes. Searching through a 100-column insert trying to figure out which table and column created the error takes an hour or more whenever it happens, but would be very quick if the table/column were specified.

This is true for regular SQL Server as well. How about making it a "SET" option in the database?
Posted by Microsoft on 12/26/2010 at 9:30 PM
Thanks for your feedback. Please let us know how important it is to have more verbose messages in SQL Server Compact. This will help us prioritize requirements and features for the future releases of SQL Server Compact.

Regards,

Ambrish
Posted by Microsoft on 9/27/2010 at 4:41 AM
Hello,

Thanks for your feedback. One of issues with having a lot of information in the exception messages is that it can unknowingly disclose more information to the end-users than what the application developer had originally planned and tested for. For example, if an application is using SQL Server Compact and is not handling the SQL Server Compact exceptions properly than the errors with the information about the database internals can be raised to the end-users. We will look into the different ways of solving the issue without disclosing internals of the database to the end-user.

Regards,

Ambrish
Sign in to post a workaround.