@@IDENTITY#

Returns the last identity value generated by an INSERT in the current session, captured at INSERT time. Returns NULL when no identity value has been captured — for example, before any INSERT in the session, or when the identity value was generated by a source other than SQL Server (capture is SQL-Server-only).

Syntax#

@@IDENTITY

Return types#

decimal(28,0)

Remarks#

Querona has no triggers, so @@IDENTITY and SCOPE_IDENTITY are equivalent — both read the same captured value, with no scope/trigger divergence.

Example#

INSERT INTO dbo.Product (Code) VALUES ('WIDGET-1');
SELECT @@IDENTITY AS LastId;

See Also#