Q:

SQL-How to Insert Row Without Auto incrementing a ID Column?

I have a table that has a forced auto increment column and this column is a very valuable ID that is retained through out the entire app.  Sorry to say it was poor development on my part to have this be the auto incrementing column.
So, here is the problem.  I have to insert into this table an ID for the column that has already been created and removed from the table.  Kind of like resurrecting this ID and putting it back into the table.
So how can I do this programatically do this without turning the column increment off.  Correct me if I am wrong, if I turn it off programatically, It will restart at 0 or 1 and I don't want that to happen...

A:

If you are in Microsoft SQL Server, you can "turn off" the autoIncrementing feature by issuing the statement Set Identity_Insert [TableName] On, as in:
  Set Identity_Insert [TableName] On
  -- --------------------------------------------
  Insert TableName (pkCol, [OtherColumns])
  Values(pkValue, [OtherValues])
  -- ---- Don't forget to turn it back off ------
  Set Identity_Insert [TableName] Off

A:

In addition to Charles' answer (which is now 100% correct :-) and which preserves the current value of the IDENTITY on the table), you might also want to check the current value of an IDENTITY on a table - you can do this with this command here:
DBCC CHECKIDENT('YourTableName')

If you ever need to actually change it, you can do so by using this command here:
DBCC CHECKIDENT ('YourTableName', RESEED, (new value for IDENTITY) )

A:

Actually, the code above for INDENTITY_INSERT is correct - turning it ON tells the server you want to insert the values yourself.   It allows you to insert values into an IDENTITY column.  You then want to turn it back off (allowing the server to generate and insert the values) when you are done.

