Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to design database for inventory management system which is small application .
In this situation i am confused with item master structure where need to create identity column or item number column which id will manually generated by using max(prev item number).
which approach is better.
From following design there is need to maintain itemno column or ID column is ok.
and also i want to know which approach is better and when to used.

ID ItemNo ItemName
28 000001 Visiting Card
29 000002 wedding card
30 000003 Company Letter
31 000004 Kids book
Posted
Updated 2-Aug-17 17:51pm
v2

1 solution

Best Practice
Always design database tables with an Identity column that is hidden from the user and a visible identifier (Item Number, Item Code, etc.) that the user can see. Doing it this way lets you code your program so that the user can change the visible identifier without affecting the other tables that are linked to this table.

Also, users may tell you during design that they will never need to change the visible identifier. They will eventually have a situation where they have to change it. Whether it is a merger with another company or someone mistyped the identifier, there will be a need to change it. Designing the database tables following the above Best Practice makes life easier for you and your users.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900