Update a numeric field starting in stated value

  • Hello,

    I had to insert a new field to a table, numeric type.

    I need to increment (+1) that field, starting in the value 5000 (for example) and looping thru each record.

    Is there any way to do it in sql using stored procedures or any other simple solution?

    Thank you,

    Augusto

  • Hi,

    Do you need to update an existing field starting 5000 and counting up.

    Or do youwant a new field to default 5000 and then the new row 5001?

    Thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • Hello,

    All rows already exist. I will add a new numeric field and go thru all the records to update that field.

    Thank you,

    Augusto

  • This is an "ordinal rank" type of question. Take a look at this article - should give you what you need to pursue in 2000:

    http://www.sqlservercentral.com/articles/Advanced+Querying/61716/[/url]

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Hello,

    Thank you for your articles. They solved my needs.

    Augusto

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

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