Cannot update identity column 'xxx', identitycolumn
Sqlserver -- how can I modify the id of the primary key to be updated manually?
#1 open the table Design Interface
#2 Change the is Identity attribute of the primary key id to No
In this way, you can use the Update statement to Update the table's primary key id.
How can I reset the auto-increment start value of the primary key id?
#1 command: dbcc checkident (tableName, reseed, 1000000)
#2 DBCC:
DBCC help ('? ') View all dbcc commands
Dbcc help ('checkdb') to view the details of a single command
Update table A set xxx = (select xxx from Table B where Axxx = xxx and Ayyy = yyy)
For example, you should not use the table name and field name in this logging interface. It is best to create an alias for the updated table,
However, this SQL statement is indeed good.
Data Change: Change multiple data entries Based on the id. Is one change or update tablename set XXX = xxx where id in (?)
In indicates that this statement processes a batch of data at the same time.
The efficiency of executing the update statement is much lower.
The results are the same, but note that the table is locked when the transaction is executed. Otherwise, others may operate on the table.