SQL Server Home
The "data was truncated" exception should specify TABLE and COLUMN names
as By Design
8/21/2010 2:40:16 AM
User(s) can reproduce this bug
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.
SQL Server Compact Edition
SQL Server Compact Edition
Operating System Language
Steps to Reproduce
Insert data into a database, one field of which is too long for its corresponding column.
An exception with message "The data was truncated while converting from one data type to another. [ Name of function(if known) = ]" is thrown by SqlCe. The exception gives no indication of what column or table had the over-sized data inserted into it.
An exception is thrown by SqlCe that includes WHAT COLUMN of WHAT TABLE was too short to accommodate the inserted data. This information may be useful, for example, to inform the user which field they should correct.
to post a comment.
Please enter a comment.
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.
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?
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.
on 9/27/2010 at 4:41 AM
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.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft