Primary key doubt

te6te6 Member Posts: 89
hi all,

There is a rule saying that If the field is part of a primary key, it should have type Code.

What happens if the field is not part of type CODE..
I mean , should any errors be faced..

Any Advice
Thanks in Advance

SUNDAR....

Comments

  • KonradKonrad Member Posts: 30
    Where did you find this rule?
  • ebsoftebsoft Member Posts: 81
    te6 wrote:
    hi all,

    There is a rule saying that If the field is part of a primary key, it should have type Code.

    What happens if the field is not part of type CODE..
    I mean , should any errors be faced..

    Any Advice
    Thanks in Advance

    SUNDAR....

    A primary key could even be a Integer. Even a single char!
    Regards,
    Federico

    MBS Specialist since NAV 2.0
    My experiences on Linkedin
  • ebsoftebsoft Member Posts: 81
    Konrad wrote:
    Where did you find this rule?

    Maybe in a book... "Programming for newbies" or for dummies!
    Regards,
    Federico

    MBS Specialist since NAV 2.0
    My experiences on Linkedin
  • Alex_ChowAlex_Chow Member Posts: 5,063
    A primary key can be anything. Check out the Item Ledger Entry. This is a perfect example of where Integer is the primary key.
  • DenSterDenSter Member Posts: 8,305
    You can use any field and/or field combination as the primary key, there is no technical reason not to use a Code field.

    The 'rule' is for certain types of tables in NAV, they are like common practice. For master tables for instance, the 'rule' is to use a Code20 type field. That doesn't mean that you can't create a master table with an integer field as the primary key, but by using those common practices your work will feel familiar to your users.
  • kinekine Member Posts: 12,562
    For me it is out of context. If I read this sentence, for me it means that if you want to use some text as part of primary key, recommanded is to use Code type an not Text type.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.