1,suser_sname
Returns the login name associated with a security identification number (SID).
Syntax
suser_sname [] )
Arguments
-
Server_user_sid
-
Is the optional login security identification number. server_user_sid is varbinary ($). Server_user_sid Can is the security identification number of any SQL server login or Microsoft Windows user or GR Oup. If server_user_sid is not specified, information about the current user is returned. If The parameter contains the word NULL would return NULL.
SUSER_SNAME can used as a DEFAULT constraint in either ALTER table or CREATE table. SUSER_SNAME can used in a select list, in a WHERE clause, and anywhere an expression is allowed. SUSER_SNAME must always being followed by parentheses, even if no parameter is specified.
When called without a argument, SUSER_SNAME returns the name of the current security context. When called without an argument within a batch that had switched context by using EXECUTE as, SUSER_SNAME returns the name of the impersonated context. When called from an impersonated context, Original_login returns the name of the ORIGINAL context.
2,suser_name
Returns the login identification name of the user.
Syntax
Suser_name []
Arguments
-
server_user_id
-
Is the login identification number of the user. server_user_id, which is optional, is int. server_user_id Can is the login identification number of any SQL Server login or Microsoft Windows user or group that have permission to connect to an instance of SQL Server. If server_user_id is not specified, the login identification name for the current user is returned. If The parameter contains the word NULL would return NULL.
In SQL Server version 7.0, the security identification number (SID) replaced the Server user identification number (SUID).
Suser_name returns a login NAME only for a login to that have an entry in the syslogins system table.
Suser_name can used in a select list, in a WHERE clause, and anywhere an expression is allowed, and must always be foll Owed by parentheses, even if no parameter is specified.
3,user_name
Returns a database user name from a specified identification number.
Syntax
user_name [] )
Arguments
-
Id
-
Is the identification number associated with a database user. ID is int. The parentheses is required.
Remarks
When ID was omitted, the current user in the current context is assumed. If The parameter contains the word NULL would return NULL. When user_name are called without specifying an ID after an EXECUTE as statement, USER_NAME returns the NAME of th E impersonated user. If a Windows principal accesses the database by-the-membership in a group, USER_NAME returns the NAME of the Windows PR Incipal instead of the group.
4,user
Allows a system-supplied value for the database user name of the current user to is inserted into a table when no default value is specified.
Syntax
USER
Remarks
USER provides the same functionality as the USER_NAME system function.
Use the USER with DEFAULT constraints in either the CREATE table or ALTER table statements, or use as any of the standard function.
USER always returns the name of the current context. When called after an EXECUTE as statement, the USER returns the name of the impersonated context.
If a Windows principal accesses the database by-the-membership in a group, USER returns the name of the Windows Princip Al instead of the name of the group.
5,system_user
Allows a system-supplied value for the current login to was inserted into a table when no default value is specified.
Syntax
System_user
Remarks
You can use the System_user function with the DEFAULT constraints in the CREATE table and ALTER table statements. You can also use it as any standard function.
If the user name and login name are different, SYSTEM_USER returns the login name.
If The current user is logged on to SQL Server by using Windows Authentication, SYSTEM_USER returns the Windows login Iden Tification name in the form: DOMAIN\user_login_name. However, if the current user is logged. SQL Server by using SQL Server Authentication, SYSTEM_USER returns the SQL Se RVer login identification name, such as willisjo for a user logged in as willisjo.
System_user returns the name of the currently executing context. If the EXECUTE as statement have been used to switch context, SYSTEM_USER returns the name of the impersonated context.
6,current_user
Returns the name of the current user. This function was equivalent to USER_NAME ().
Syntax
Current_User
Remarks
Current_User returns the name of the current security context. If Current_User is executed after a call to EXECUTE as switches context, Current_User'll return the name of the Imperson Ated context. If a Windows principal accessed the database by-the-membership in a group, the name of the Windows principal would be re Turned instead of the name of the group.
To return the login of the current user, see SUSER_NAME (Transact-SQL) and SYSTEM_USER (Transact-SQL).
Reference Documentation:
https://msdn.microsoft.com/en-us/library/ms174427.aspx?f=255&MSPPError=-2147217396
Returns the function collection for user name