T-SQL 101: 131 What are Identity Columns in SQL Server?
In the previous post, I talked about how you could add default values for columns.
One special type of default value is called an IDENTITY constraint. These columns are one way to achieve automatic numbering in a column. There are many pros and cons about using these but at this point, I want to make sure you know how to use them.
The main difference from other columns is that you don’t put them in your INSERT statements. In fact, unlike other types of default constraint, you cannot just put the values in there. It will raise an error.
2025-03-18