AutoIncrement Property of the filed

Isaland
Isaland Member Posts: 52
Hello :D

There is a new table with primery key "Entry No." (Integer)
Сustomer need AutoIncrement Property for this field.

I have simple report, which imports lines from Excel to this table.
When it try to Insert second line, it use previous "Entry No." and runtime error occurs

How to perform Navision increment "Entry No." after Insert?
MB7-840

Best Answer

Answers

  • lvanvugt
    lvanvugt Member Posts: 774
    Did you set the AutoIncrement property on the "Entry No." field?
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • Isaland
    Isaland Member Posts: 52
    kine wrote:
    It depends on your code. When inserting data into Autoincrement table (table with field with enabled Autoincrement), you need to set the field to 0 and do the insert. You cannot set it before insert, else it will give you SET IDENTITY error when you are not db_owner.

    Thanks, it works. I put "Entry No." := 0; before Insert :thumbsup:
    MB7-840