$IDENTITY
pseudo-column reference $IDENTITY resolves to the identity column
What changes
- Input
- the table's identity column
- Output or change
- column value
Syntax at a glance
SELECT $IDENTITY FROM table
Work example
A query needs to display the identity column without hard-coding its column name.
Use a table that has exactly one identity column in a disposable query and compare the pseudo-column with the named column.
Check your work $IDENTITY. The returned value matches that table's identity column and is not confused with a generated key from another source.
Open Microsoft Learn for full syntax, permissions, and details for your version.