Hi @César Morgado
There is no straightforward T-SQL like ALTER TABLE… to add an Identity Property to an existing column in a table.
If the column is empty, then create a new column with identity(1,1) and then drop the existing column.
If already exist value in that column, then you might consider using SEQUENCE, like this:
CREATE SEQUENCE test_sequence_name START WITH max_existed_value_in_column_plus_one INCREMENT BY 1;
ALTER TABLE your_table_name ADD CONSTRAINT constraint_name DEFAULT NEXT VALUE FOR test_sequence_name FOR column_name
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".