The SUSER_NAME scalar function could cause server instability and the USER_NAME scalar function incorrectly returned the same result as the USER function. These functions have been rewritten to fix these problems. They now both correctly return the name of the user who is currently logged in.
Notice that the USER scalar function returns the name of the user under which it is currently running, which may be different from the login user during stored procedure execution. The name will be either the login user or (if the function is called within a stored procedure) the owner of the stored procedure.
The following scalar functions were also reviewed: