ID vs AutoID

Feb 21, 2007 1 Replies

I've been running some SQL Profiler traces against the Headquarters database (RMS 1.3), specifically to see what happens when a new ShipTo address is added to a customer who previously had no Shipto address.



I've discovered that most of the queries (SELECT and UPDATE) executed against the Customer and ShipTo tables use a field called AutoID in the WHERE clause. Apparently this field is also the Primary Key for these tables. I don't believe this was always the case.



Let's see now; we've got the ID, which was the system genrated unique ID when this customer and address was created at the store level, we've got the HQID, which serves the same purpose, but on a global level (and this i what I had been using as the unique identifier in all of my queries), and now there's this AutoID. Was this a new field added as part of 1.3? Why do we now have three uniue identifiers for a customer or address (the HQID, the storeid+ID, and AutoID)? I've aways used the ID or the HQID in my JOIN conditions. Has this changed as well, and will this continue to change in v.



2.0?

Serves me right for thinking that I could depend on stable primary key columns in my database.



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required