Serial Number Table

  • Hello Everyone,

    I need to create a table which generates unique number for different categories. Here is how it looks.

    JobFunction     SerialNo

    Purchase         2315487

    ShopFloor        1245863

    Sales               2254858

    Each time if I want a purchase number I have to get the next number of the purchase job function and similar to the other job function

    Which is the best way to create this table? Since I am new to SQL I am not sure which way will make the database more optimized.

    Thanks,

    Senthil

     

  • Probably the easiest way to do this would be to use the IDENTITY feature on the field you want to create a number for.  This will produce a unique integer value each time a row is inserted.  You can specify the increment value and the starting value for the seed number when the table is created to establish things such as minimum length and variation between ID's.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply