how to change a column and primary key to Identity?

Asked

Viewed 85 times

0

Well I made a table in sqlserver and put the primary key as normal int but I need to change it to Identity. how do I??

  • need to delete the current column and include a new one, such as identity

  • worth helping me dms !

1 answer

2

You can change via command or via Management Studio. Via command you will have to remove the column and add it again:

ALTER TABLE Cliente
DROP COLUMN Id   

ALTER TABLE Cliente
ADD ID INT NOT NULL Identity(1,1)

via Management Studio: inserir a descrição da imagem aqui

  • 1

    Thank you very much helped!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.