Is it possible to have more than one identity column in sql

I want to create more than one identity column in my table. So is it possible to do that.

No, We can not do that. Let’s understand by example.

I am trying to create a table which has two column and both columns are identity.

Syntax

Create table abc(
Id int identity,
Sid int identity
)

Press F5 and see the out put.

Msg 2744, Level 16, State 2, Line 1
Multiple identity columns specified for table ‘abc’. Only one identity column per table is allowed.

So we can not create more than one identity column in table.

I hope you enjoy this article.

Happy coding 🙂