hefterr
asked on
Adding a row keyed by an IDENTITY
Hi,
I have an integer key that is an IDENTITY starting at 100. Can I INSERT a row and specify the identity key value if it's less than 100? Can I ever specify the IDENTITY value in an INSERT?
Thanks,
hefterr
I have an integer key that is an IDENTITY starting at 100. Can I INSERT a row and specify the identity key value if it's less than 100? Can I ever specify the IDENTITY value in an INSERT?
Thanks,
hefterr
never tried it, but looks like you can with IDENTITY_INSERT
http://www.sqlteam.com/article/how-to-insert-values-into-an-identity-column-in-sql-server
http://www.sqlteam.com/article/how-to-insert-values-into-an-identity-column-in-sql-server
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey Thanks. One more question. If I insert a row higher than the identity counter for my table, will that identity value be skipped ny SQL Server in the future or will I end up with a duplicate key situation?
Thanks again.
hefterr
Thanks again.
hefterr
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://msdn.microsoft.com/en-us/library/ms188059.aspx