Imagine that I have a Customer table.
And in this table is an ID column, Primary Key int, Identity, all that jazz. Our Customer also has a Name.
Now, if I was to send out information in a report, or an e-mail blast, where there was a link back into my website to uniquely identify that Customer, would it be good practice to use the Primary Key ID field?
All my instincts are telling me this is awful, and that surrogate IDs should PURELY be used for the database only – and never exposed to the outside world in this way.
But I’m looking for that killer argument that I could use in the future, if (when) presented with this case.
Thoughts?
I’d suggest not adding a new field, but also don’t expose the Id.
Create a table to store emails that you send out. Include a GUID as the primary key and UserId as a foreign key. In the URL you are giving them, link back to the GUID. Then if a user clicks on a URL you can updated the record based on the GUID and indicate when the user accessed the URL.