Return the database user name (will return the current user since no id is specified):
SELECT USER_NAME();
Try it Yourself »
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.
USER_NAME(
id_number)
Parameter | Description |
---|---|
id_number | Optional. The id number of a user in the database |
Works in: | SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!