Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What does PK and index do for a table?
Message
From
25/10/2018 14:18:24
 
 
To
23/10/2018 10:45:30
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01662673
Message ID:
01662796
Views:
49
>if you use invoice id for key field you have to use invoice id for invoice lines and some other tables for reference. When you want to change invoice id you have to update all tables and this will a bit risky (programming mistakes, possible deadlock because of a long one transaction) and slow. but if you use identity column for this you just update your invoice no at just one table, use identity as reference with other tables.

The invoice master table has only one row for each invoice.
I've never seen an accounting system that would let someone change an invoice number but if there was one, an identity column would work.
Yes, invoice details rows need a way to identify themselves in addition to the invoice number, so an identity column in that table makes sense.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Reply
Map
View

Click here to load this message in the networking platform