SQL Server USER_NAME() Function
Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
SQL Server USER_NAME() Function
❮ SQL Server Functions
Example
Return the database user name (will return the current user since no id is
specified):
SELECT USER_NAME();
Try it Yourself »
Definition and Usage
The USER_NAME() function returns the database user name based on the specified id.
If no id is specified, this function will return the name of the current user.
Syntax
USER_NAME(id_number)
Parameter Values
Parameter | Description |
---|---|
id_number | Optional. The id number of a user in the database |
Technical Details
Works in: | SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
More Examples
Example
Return the database user name with id 1:
SELECT USER_NAME(1);
Try it Yourself »
❮ SQL Server Functions