Text value exceeds text field length

KeithMMooreKeithMMoore Member Posts: 59
I have a new client preparing to move from the native DB to SQL. We discovered this morning overflow errors when trying to restore the backup into SQL on some Sales Invoice Header records for Name and Address.

Upon checking, I discovered that the actual length of the data in the field was 31 characters despite the field length being defined as 30. Was/is there some interesting feature in the native DB that would allow this? Anyone else run into this and/or is there any way to test for this condition easily?

Thanks,

Answers

  • Alex_ChowAlex_Chow Member Posts: 5,063
    Possible someone altered the database structure in SQL?

    Are you doing the restore on a freshly created SQL database?
  • KeithMMooreKeithMMoore Member Posts: 59
    No. To speed the process up we decided to simply create a new 4.0 SQL database, back up the native and restore. Both DBs define the field length of Sales Invoice Header at 30.

    The strange part was the the actual data in the recor creating the overflow error was 31 characters in length in the native DB, despite the field length being 30. I would have thought that that was not possible even if the client had originally imported data into the Sales Invoice Header from another application [we were not the VAR who did the original conversion to Nav]
  • DaveTDaveT Member Posts: 1,039
    Hi Keith,

    I think this explains how your problem occured - from the application developers guide
    In C/SIDE Database Server, data is stored with a four byte alignment because of
    performance considerations. The sizes of text, code and binary fields (that can have
    variable lengths) are rounded up to the nearest value that is a multiple of four. This
    means that, for example, a text string of 10 characters will occupy 12 bytes.

    so the addresses would occupy 32 bytes
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • KeithMMooreKeithMMoore Member Posts: 59
    Sounds reasonable - Thanks much.
Sign In or Register to comment.