add data to sequence number field

  • Hi,

    How do you add data to a sequence number field for an existing tables with a lot of records automatically? If I need to use stored procedure, please advise me where I can download the sp and I will modify it. Thanks.

    Supernova

  • If you need a standard sequence number 1-... then you can use

    ALTER TABLE tblname ADD column_name INT NOT NULL IDENTITY(1,1)

    Keep in mind INT can only handle so many records, if on SQL 2K you can try bigint if needed.

    Now if the item needs a specific value based on criteria you can use a trigger or build logic in procedure to pass data to and have pick the right number.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

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

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