Error 8102

Troubleshooting SQL Server

Troubleshooting

Error 8102

Severity Level 16
Message Text

Cannot update identity column '%.*ls'.

Explanation

You have specifically attempted to alter the value of an identity column in the SET portion of the UPDATE statement. You can only use the identity column in the WHERE clause of the UPDATE statement.

Action

Updating of the identity column is not allowed. To update an identity column, you can use the following techniques:

  • To reassign all identity values, bulk copy the data out, and then drop and re-create the table with the proper seed and increment values. Then bulk copy the data back into the newly created table. When bcp inserts the values it will appropriately increase the values and redistribute the identity values. You can also use the INSERT INTO and sp_rename commands to accomplish the same action.

  • To reassign a single row, you must delete the row and insert it using the SET IDENTITY_INSERT tblName ON clause.

See Also

bcp Utility

INSERT

SET IDENTITY_INSERT

sp_rename

UPDATE