Listing Login Users in SQL Server
Hello everyone,
In this article, I will try to give information about listing Login users in SQL Server.
In SQL Server you may want to list Login users in some cases.
You can easily do this using the code below.
SELECT name AS Login_Name,
type_desc AS Account_Type,
CASE
WHEN is_disabled = 1 THEN
'Disable'
ELSE
'Enable'
END AS IsEnable,
create_date
FROM sys.server_principals
WHERE type IN ( 'U', 'S', 'G' )
ORDER BY name,
type_desc;
When you run the above code, you will see a result similar to the one below.
As you can see, we have listed the Login users.
Good luck to everyone in business and life.