This function is commonly used, so remember it in case you forget it.
Scope_identity
Returns the last identity value inserted into the identity column in the same scope. A scope is a module-stored procedure, trigger, function, or batch processing. Therefore, if the two statements are in the same stored procedure, function, or batch processing, they are in the same scope.
Ident_current
Returns the final id value generated for any session and specified table in any scope. This function requires a variable named "Table value". That is to say, although it is not restricted by sessions and scopes, it is restricted by tables.
@ Identity
Returns the last inserted id value.
Experience: with transaction processing, there is no essential difference between two functions and one variable. Two functions with no transaction processing are affected by other sessions and scopes.