Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to set is Identity key as Yes in SQL Server

I just not created a new database with 2 tables in it. In a table, I have set a column as a primary key and trying to change its properties i.e. setting is Identity to YES, but am not able to do so.

Any ideas/suggestions?

like image 672
tech_learner Avatar asked Dec 21 '22 16:12

tech_learner


2 Answers

Make sure the datatype is int and not something else.

You can't have an identity on a different type.

like image 123
Max N Avatar answered Jan 05 '23 03:01

Max N


Do you have data in the table? You can't make an IDENTITY column if you do.

like image 34
Wyatt Barnett Avatar answered Jan 05 '23 03:01

Wyatt Barnett