Finding Login Counts and Creation Dates

Several example queries against syslogins and sysusers can give you the login and user information you need.

ITPro Today logo in a gray background | ITPro Today

How can I find out how many logins are in a SQL Server database and when they were created?

Here are several queries that return information about logins on your SQL Server. To find the count of logins on your SQL Server, you can execute the following query:

SELECT COUNT(*)   FROM master..sysloginsGO

You can execute the next query to get a list of logins on your server as well as the creation date of each login:

SELECT name, createdate   FROM master..sysloginsGO

Similarly, you can execute the following queries in a database to find the count of users for that database, a list of the user names, and the dates the users were created:

USE GOSELECT COUNT(*)   FROM sysusersSELECT name, createdate   FROM sysusersGO

These queries should give you the login and user information you need.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like