How to find login name in SQL Server from a user_name of database

Kira

How can I find login name in SQL Server from a user_name of database using a stored procedure?

Serg

For example you can use the system functions

declare @uname sysname = 'dbo'; -- user name in question
SELECT suser_sname(user_sid(USER_ID(@uname))) as login

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to pass user_name based on the user_ID from login page to home page using mvc

Change Login name (Windows user) for an existing SQL user on the Database server

How to find a specific name from a string in sql server table data

How to parameterize database name in SQL Server

How to use database name dynamically in SQL Server

Error in SQL Server when connecting to PowerBI Datamart [Unsupported sql function USER_NAME]

how to get user_name from the title that has "eJx2" in it from this json array?

Drop user without a name from sql database

Login Authentication from SQL Server database

Remove database name from ODBC (SQL Server) table list

SQL Server Express login failed for user domain\name

How to get another table from the same sql data source without having to type the server name and database name again?

How to find the database name using the table name?

How to get index names for all databases by database name on a SQL Server

How to drop a database if a variable with its logical name exists in SQL Server?

How to get the schema name for sysobjects when querying a sql server database

How to search a column name in all tables in a database in SQL Server 2012?

How to get SQL Server database name without logging in?

EF Core migrations SQL Server - how to get database name?

SQL Server: How to use a database name as a parameter in a stored procedure?

How to Know who creates (host name) a database in sql server?

How can I change database name in Sql Server with code?

How to find JNDI name when creating entity classes from a database?

How to find user name from the session ID?

How to find already installed sql server 2014 instance name and version?

How to find the name of not-null constraints in SQL Server

How to retrieve last login for each user from SQL Server?

How to find the domain name of a server?

Find a column name from all tables and all databases with specified column name SQL Server