DEV Community

Discussion on: Use the right tool to get identity values back after an insert

Collapse
zchtodd profile image
zchtodd

Nice! Although I have to admit I've never seen an identity column type before, what does that do? I've never used SQL Server before, so apologies if that's a super obvious question.

Collapse
peledzohar profile image
Zohar Peled Author

Identity is not a column type but a property you can set on an integer column. (only when creating the column, though).

Once set, SQL Server will automatically populate the identity column with auto-generated values any time you insert rows to the table.

Basically, it's like a serial column in PostgreSQL or an auto_increment column in Oracle / MySql.