alter table image alter column ID int identity (1, 1) not null
I can only query analyzer, so this is the only option, the system prompts an error. How can this problem be solved ??
================================================= ================< br> you cannot directly change it to an ID column:
you can add a new ID column, set the ID column to be allowed to be modified, fill the ID column with the original field value, and delete the original field, rename the field
alter table table add number 1 bigint identity (1, 1) not null
go
set identity_insert table on
go
Update table set no. 1 = No
go
set identity_insert table off
go
alter table table drop column No.
go
exec sp_rename 'table. 1 ', 'number'
go
============================= ================================< br> alter table [Image] alter column [ID] int identity) not null
========================================================== ============
Alter table table add number 1 bigint identity (1, 1) not null
Go
Alter table table drop column no.
Go
Exec sp_rename 'table. No. 1', 'No'
Go
========================================================== ============