How to configure an existing field for auto-increment?

1

I would like to set the id field already created as auto-increment, because I created the table and did not put this option for it, how could I do this?

    
asked by anonymous 25.02.2016 / 15:53

1 answer

4

To change, simply use the following command:

For SQL Server:

ALTER TABLE <TABELA>
ALTER COLUMN <Nome_Coluna> Identity (1,1) // caso for sql server

For MySQL:

ALTER TABLE <TABELA>
MODIFY COLUMN <Nome_Coluna> AUTO_INCREMENT // caso for My SQL
    
25.02.2016 / 16:51