hello everyone,
i have an issue where i need to change the primary key of the Resource Price table. Currently the table's P.K. is
Job No.,Type,Code,Work Type Code,Currency Code
i have added 3 new fields to this table, lets say #1,#2 and #3.
well, i need to change the P.K. to
Type,Code,#1,#2 and #3.
i don't want to change the P.K. that is currently there b/c other code may reference this P.K. for sorting and if i change the P.K., it will cause unforeseen problems! And plus, i don't know how many forms, reports, dataports or codeunits reference this P.K.
i was going to just add a secondary key, the one i need, but the problem is that i can have duplicate jobs and the P.K. has job as part of the P.K.
i know that the P.K. will be added to every secondary key. i will not need to use the Work Type Code and Currency Code fields.
so, should i change the P.K. to what I need?...i think this is a big No, No!
or should I add a secondary key? if so, how will i get around having the same jobs since this field is part of the P.K.?
or would i have to do some coding? like maybe use SETCURRENTKEY to my new 2ndary key when inserting a new record on the Resource Price FORM? but then i'm back to not having duplicate Jobs!
](*,)
the only thing that can NOT duplicate is the key I need,
Type,Code,#1,#2 and #3.
i appreciate any input!
0
Comments
Now, I believe that Navision only references the fields in the keys, and that the keys do not have any unique IDs of their own, so any code elsewhere in the system that refers to the key set up as what is currently in the P.K. will continue to work because a secondary will exist with those exact fields.
Test it and find out for sure!
Microsoft Dynamics NAV Developer
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
but i was thinking that if i create a new table, i will still need to make sure that where i use this table, i have to make sure the parameters are correct...so it seems to be the same amount of work as appending to the p.k. .....which i will probably do! unless 1 way is easier or better than the other?
thanks Captain DX4 and Kine for your inputs.....much appreciated!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If you change the primary key, it will also change the sql column ID of the field(s). Of course you can't see it in Navision, nor it will affect Navision. But if you use Business Analytics, this change will give you some homework since BA use sql column ID for its DTS script.