Link to home
Start Free TrialLog in
Avatar of chetan1981
chetan1981

asked on

LIst od SQL Logins

Hi,

Could anyone please help me out with what tables to query when lookng for a list of active logins on SQl Server. I am new to SQLServer so am kinda confused.

Any help will be much appreciated.!!!

Thanks
Avatar of Atlanta_Mike
Atlanta_Mike

For server logins...

SELECT * FROM master.dbo.sysxlogins

For database.

USE databasename

SELECT * FROM sysusers
Avatar of chetan1981

ASKER

Works!!

Just one small question, name field comes up as 'NULL' for many of the rows. If that is null then what are the credentials associated with the user/application when logging in?

Thanks
which table?
Its for table master.dbo.sysxlogins

Also is there a way to pull in the fixed server roles associated with these logins as well??

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Atlanta_Mike
Atlanta_Mike

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Chetan.. dont use  "SELECT * FROM master.dbo.sysxlogins"... because it not meant for our use.
Instead use the view syslogins.

Doubt my statement.. ??? good...
Do this..
Configure replication on the server.. configure the box as publisher as well as distributer... now query "SELECT * FROM master.dbo.sysxlogins".... Do you see multiple entries for SA :-)

Well we took hours to figure out where that entry was coming from.

thx
VJ
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to both of you for helping