Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to reset identity(ID) field

How to reset identity(ID) field

Scheduled Pinned Locked Moved Database
databasesql-serversysadmintutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mubashir Javaid
    wrote on last edited by
    #1

    I am using SQL server 2000. I have added some records in table. and then deleted. Now I would like ID field to start count from 1 and onward. what command will be used.

    God Bless you. Always do good to others

    V B 2 Replies Last reply
    0
    • M Mubashir Javaid

      I am using SQL server 2000. I have added some records in table. and then deleted. Now I would like ID field to start count from 1 and onward. what command will be used.

      God Bless you. Always do good to others

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      DBCC CHECKIDENT Check out http://www.mssqlcity.com/FAQ/Devel/reset_identity_column.htm[^]

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      M 1 Reply Last reply
      0
      • M Mubashir Javaid

        I am using SQL server 2000. I have added some records in table. and then deleted. Now I would like ID field to start count from 1 and onward. what command will be used.

        God Bless you. Always do good to others

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        dbcc checkident(tablename,reseed,1)


        I Love SQL

        1 Reply Last reply
        0
        • V Vasudevan Deepak Kumar

          DBCC CHECKIDENT Check out http://www.mssqlcity.com/FAQ/Devel/reset_identity_column.htm[^]

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          M Offline
          M Offline
          Muhammad Qasim Pasta
          wrote on last edited by
          #4

          I agree... but what about the relationships and constraints ... if I have a primary key of identity column .. then that statement will generate value that already exists in my table.... m I right?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups