These are from online books:
@ Identity Stored Procedure
Returns the last inserted id value.
Syntax
@ Identity
Return type
Numeric
Note
After an insert, select into, or large-capacity copy statement is completed, @ identity contains the final id value generated by this statement. If this statement does not affect any table with an ID column, @ identity returns NULL. If multiple rows are inserted, multiple ID values are generated. @ identity returns the final id value. If one or more triggers are triggered to execute the insert operation that generates the id value, @ identity is called immediately after the statement is executed, and the last id value generated by the trigger is returned. If the insert or select into statement fails, the large-capacity copy fails, or the transaction is rolled back, @ identity The value is not restored to the previous setting.
Example
The following example inserts a row into a table with an ID column and uses @ identity to display the id value used in the new row.
Insert into jobs (job_desc, min_lvl, max_lvl) values ('accountant ', 12,125) Select @ identity as 'identifi'