Notifications
Announcements
No record found.
Hi all,
what is the exact difference between surrogate key and recid.
Thanks®ards,
lalitha.
*This post is locked for comments
Hi,
In fact there is no difference. The RecId indexes are coming from older versions of AX whereas the SurrogateKey is defaulted for new created tables in AX 2012.
RecId is a field used by Dynamics AX to uniquely identify records.
Surrogate (AKA synthetic) key is a logical concept coming from database design theory, describing a key that is generated by the database system itself; it's not (like usual keys) based on business data. Obviously RecId is such a surrogate key.
Also note that AX (since AX 2012) automatically creates an index called SurrogateKey (if you create a new table, you'll see it's used as PrimaryIndex and ClusterIndex), therefore when you hear "surrogate key", people may also be talking about this index.
The exact difference is that RecId is an Extended Data Type based on int64 from which you may create Fields in AX, while a Surrogate Key is a unique identifier in a table. Majority of the AX Tables have RecId field by default that is populated by the kernel automatically from a sequence per each table, thus making it a Surrogate Key by definition.
A surrogate key typically has no meaning to a user. In Microsoft Dynamics AX 2012 the primary key for every new table is always enforced by an index that has exactly one field. The one field is usually an incremented number, or a completely meaningless number that is generated by the system.
For new tables the default is a primary key based on the RecId field. This is represented as the surrogate key in the user interface.
This auto-generated primary key - the surrogate key is linked to the already existing RecId field within any table. A surrogate key is a unique 64-bit integer value that is mandatory for the table and cannot be changed or have duplicates. It is a 64-bit integer (int64) value which means table operations normally perform faster than other types of field such as string fields.
In the form designer a reference group is a way of displaying the replacement key index fields for a table instead of the surrogate key, which is normally the RecId, for the table.
While surrogate keys and replacement keys can be helpful, these are not required for functional tables and forms.
Surrogate keys were available in Ax 2009, but were not so helpful until the kernel changes introduced at Ax 2012 - see this blog for some useful insights axdaily.blogspot.ae/.../surrogate-keys-in-ax-2012.html
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Priya_K 4
Martin Dráb 4 Most Valuable Professional
MyDynamicsNAV 2