To manage tables

  • I have a table in which 1 identity column means auto increment of 1.If i delete 1 or more than 1 rows in a table,then it should be reformatting.For example,Like 10 rows in a table,if we delete 3rd rows then the identity column will be managed from 1 to 9 serially.

    Col1 col2

    1 A

    2 B

    3 C

    4 D

    5 E

    After deleting 3 rows:

    Col1 col2

    1 A

    2 B

    3 D

    4 E

  • That's not how auto-incrementing works.

    Usually, auto-incrementing is used to create a unique number to refernce that in another table. If you renumber your values, you'd change the references.

    Why do you need to have it numbered without gaps?

    Anyhow, you could renumber Col1 using ROW_NUMBER()...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

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

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