Inserting records/assigning sequence # to key value

  • Hi.  I feel rather dumb even having to ask this question, but I seem to have a mental block  and I need to get this done.   I have a table that has been created to store sorted data.  The key for the table is a numeric field (SORTID) that I want to be assigned a sequential number as records are inserted into the table so that I can keep track of the order in which they were inserted.   Example,  first record in table has SORTID = 1, second record has SORTID = 2, etc.

    I'm sure there is an easy way to have this happen automatically for me when a new record gets inserted but seeing how I usually work as an application developer where these things are already established for me , I am having some difficulty.

    Thanks for any help!! 

    ~mj

  • You need to change the SortId col to an Identity column with an increment of 1.



    ----------------
    Jim P.

    A little bit of this and a little byte of that can cause bloatware.

  • That is almost too easy. 

    I actually do have it set up that way right now.  I also have the Identity Seed set to 1.  Is that correct?  That tells it to start with 1 for the first record, right?

    Thanks a bunch!!

    ~mj

  • That's all there is to it.



    ----------------
    Jim P.

    A little bit of this and a little byte of that can cause bloatware.

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

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