>For those that advocate using surrogate foreign keys (non-business key) I have a question. How do you best handle sorting on a foreign key? For example, I have an Ap invoice table with a foreign key to my vendor table (unique integer). I don't have any way to SET ORDER to my vendor field to easily sort my invoices by vendor id. I could bag the integer foreign key in the Invoice table and replace it with the vendor id itself or I could include both the integer key value and the actual vendor id in my invoice table. I like using the integer for speed, ease of use, etc. and although it violates normalization, it may be helpful to have both for sorting. Any suggestions?
I do this sort of things (no pun intended) with SQL, or, better yet, with views.
I do not only try not to have business keys, but I even try to do away with all keys; users pick values from dropdown comboboxes, and thus the idea of sorting by the key value doesn´t make sense. All (well, most of) my reports are ordered alphabetically by name, and I must use SQL or views to build them.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only