Skip navigation

Finding Login Counts and Creation Dates

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..syslogins
GO

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..syslogins
GO

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 <your_database_name>
GO
SELECT COUNT(*)
   FROM sysusers
SELECT name, createdate
   FROM sysusers
GO

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

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish