IDENTITY vs Autonumber generation in the procedure

  • Hi

    I have table Booking,BookingID is the primary key and datatype is integer.

    I am confused whether to generate this primary key with Identity or to generate in a procedure with this code

    DECLARE@intBookingID int

    SELECT @intBookingID = ISNULL(MAX(BookingID),0) + 1--Primary Key auto generated

    FROM [dbo].[tbl_Booking]

    I am using this table in B2C application...there would be lot of booking at a time.

    Which process will be better to generate the autonumber.

    Thank you

    withy regards

    Dilip D

  • By autonumber I assume you mean identity column. Unless you have a compelling reason to want to control the increment yourself I see no reason to do it in code. Let the system handle it..

    CEWII

  • you can use Identity for your solution................!

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

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