Create a field for identity and populate it

Hello guys

I have a table with 200 rows and this table doesn't have a identity field. I need to create a field name seq as a int and after that
populate it with number and then create a primary key.

to create the field, I know how to.
to create the primary key I know how to

to populate it with a incrimental number, I don't know.

how to do that?

Who is Participating?
Vitor MontalvãoConnect With a Mentor MSSQL Senior EngineerCommented:
Just create the column with the identity property and the table rows will be automatically populated. Check the following example that starts with 1 and increment by 1 (1,1):
	ADD MyIdentityColumn INT IDENTITY(1,1)

Open in new window

hidrauAuthor Commented:
thanks a lot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.