Click here to Skip to main content
13,347,998 members (63,931 online)
Rate this:
Please Sign up or sign in to 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 25-Jan-13 23:42pm
Updated 2-Aug-17 18:51pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 2 Aug 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100