Alter Table Identity. ALTER TABLE EMPLOYEE_TEMP ADD COLUMN id2 int IDENTITY11. ALTER TABLE test_new ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY.
Thanks You cant alter the existing columns for identity. There is no straightforward T-SQL like ALTER TABLE or MODIFY COLUMN to add an Identity Property to an existing column in a table. There are two ways to alter an identity column.
ALTER TABLE EMPLOYEE_TEMP ADD COLUMN id2 int IDENTITY11.
Use the ALTER TABLE statement to alter the definition of a nonpartitioned table a partitioned table. There is a workaround for the same which I have discussed in depth over the article Add or Remove Identity Property on Column. The following ALTER TABLE ADD statement appends a new column to a table. The exception is START WITH LIMIT VALUE which is specific to identity_options and can only be used with ALTER TABLE MODIFY.