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. Change value of existing rows of an identity column

Change value of existing rows of an identity column

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
2 Posts 2 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.
  • H Offline
    H Offline
    Harini N K
    wrote on last edited by
    #1

    Hi experts, I want to change value of an identity column without dropping table / references / constraints / deleting rows from that table. I am using SQL server 2005 and I have tried to modify the column as identity seed to NO using MS SQL Server Management Studio but it is hanging. Is there any SQL statement to modify that column as Identity Seed to NO.?

    Harini

    M 1 Reply Last reply
    0
    • H Harini N K

      Hi experts, I want to change value of an identity column without dropping table / references / constraints / deleting rows from that table. I am using SQL server 2005 and I have tried to modify the column as identity seed to NO using MS SQL Server Management Studio but it is hanging. Is there any SQL statement to modify that column as Identity Seed to NO.?

      Harini

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      Harini N K wrote:

      I am using SQL server 2005 and I have tried to modify the column as identity seed to NO using MS SQL Server Management Studio but it is hanging.

      This normally indicates that there are existing connections open that have taken Schema Stability locks on the table. These locks should be shortlived - check for transactions that haven't been committed or rolled back. To disable the identity feature completely, use ALTER TABLE _table_ ALTER COLUMN _column_name data_type_. It sounds, though, as if you want to set the identity value of some existing rows, or set the identity value of new rows you're inserting. To do this, use SET IDENTITY_INSERT _table_ ON. It's normally a good idea to turn this off when you're done. Also, use DBCC CHECKIDENT to ensure that the next row inserted which uses the identity value does not get a clashing value.

      Stability. What an interesting concept. -- Chris Maunder

      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