Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Query for Logins

Tags:

sql

sql-server

What is the SQL query to select all of the MSSQL Server's logins?

Thank you. More than one of you had the answer I was looking for:

SELECT * FROM syslogins  
like image 674
Jim Avatar asked Aug 31 '08 23:08

Jim


People also ask

How do I query a SQL Login?

SQL Server: Find Logins in SQL Server Answer: In SQL Server, there is a catalog view (ie: system view) called sys. sql_logins. You can run a query against this system view that returns all of the Logins that have been created in SQL Server as well as information about these Logins.

How do I get list of Logins and permissions in SQL Server?

First, move to “Object Explorer” and expand the database that you want. Next, under the database, expand the “Security” directory. Now, under Security, expand the “Users” option. This will display a list that contains all the users created in that database.

How do I find my SQL Server Login credentials?

In SQL Server Management Studio Object Explorer, right-click on the server name, click Properties and go to Security page to check the SQL Server Authentication.


2 Answers

Is this what you're after?

select * from master.syslogins 
like image 101
Brad Wilson Avatar answered Sep 27 '22 18:09

Brad Wilson


On SQL Azure as of 2012;

logins:

SELECT * from master.sys.sql_logins 

users:

SELECT * from master.sys.sysusers 
like image 20
DeepSpace101 Avatar answered Sep 27 '22 17:09

DeepSpace101