That being said, here are some tips on how to get around problems with IDENTITY columns and getting data in sync:
IDENTITY_INSERT
You can temporarily turn identity insertion off with the following statement:
SET IDENTITY_insert <table> ONYou can now insert the identity values into your table. Don't forget to run the same statement on the table, substituting ON for OFF!
Reseeding the IDENTITY value
For example, if you want to reset the current identity value on a table to 100, you can use the following statement:
DBCC CHECKIDENT ( 'schema.table', RESEED, 100 )
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.