none
"truncated result" when trying to save changes to database object RRS feed

  • Question

  • I am populating database tables from memory using EF 5 under transaction control (probably not relevant).

    When I finally try to "Database.SaveChanges()" I get an UpdateException with "truncated result" but I cant seem to see any information as to what object is causing this or why it might be occuring.

    Is there any more information I can obtain from the exception object to help determine what the problem is?

    Thanks


    Friday, August 24, 2012 11:13 AM

Answers

  • Thanks for your help it does seem as if I was saving a value of better precision than configured.

    I changed my tables to match the precision and now I dont get the error.

    • Marked as answer by PeterGillham Friday, August 24, 2012 3:47 PM
    Friday, August 24, 2012 3:47 PM

All replies

  • Hi,

    Could you quote the exact error message to avoid any misinterpretation. You could also check the inner exception (or rather the BaseException) to get at the verty first exception that was raised.

    Could it be a "string or binary data would be truncated" SQL Server side error that usually happens when you try to use a string that is longer than the size defined in the db ?


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Friday, August 24, 2012 11:18 AM
  • Forgot to mention - big oops sorry -  I am using EF with Oracle

    System.Data.UpdateException - "An error occurred while updating the entries. See the inner exception for details."

    InnerException - {"truncated result"}

    [Oracle.DataAccess.types.OracleTruncateException] - {"truncated result"}

    I will try and look for this on Oracle site too as in may be an ODP (Oracle Data Provider) issue.

    Friday, August 24, 2012 11:27 AM
  • It seems to be how Oracle reports a similar issue. I would look at the generated SQL statement using Oracle SQL trace tools and it's likely that it tries to update a db value with a client side value that has a better precision (for example a string that is too long or a date only while client side you also have a time portion or a decimal value that exceeds the precision and/or scale such as shown here : http://stackoverflow.com/questions/6606076/oracletruncateexception ?)

    So in short your best is likely to trace the SQL statement sent to Oracle to find out what is the wrong value which is sent...


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Friday, August 24, 2012 12:03 PM
  • Thanks for your help it does seem as if I was saving a value of better precision than configured.

    I changed my tables to match the precision and now I dont get the error.

    • Marked as answer by PeterGillham Friday, August 24, 2012 3:47 PM
    Friday, August 24, 2012 3:47 PM