SQL Server - @@ROWCOUNT, @@IDENTITY
@@ROWCOUNT Get affected rows when do UPDATE / DELETE / INSERT
Note that:
@@ROWCOUNT is reset after every statement so you must retrieve the value immediately with no intervening statements.
Pasted from
@@IDENTITY
After an INSERT, SELECT INTO, or bulk copy statement is completed, @@IDENTITY contains the last identity value that is generated by the statement. If the statement did not affect any tables with identity columns, @@IDENTITY returns NULL. If multiple rows are inserted, generating multiple identity values, @@IDENTITY returns the last identity value generated.
Pasted from