• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

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
0
chetan1981
Asked:
chetan1981
  • 3
  • 3
  • 2
2 Solutions
 
Atlanta_MikeCommented:
For server logins...

SELECT * FROM master.dbo.sysxlogins

For database.

USE databasename

SELECT * FROM sysusers
0
 
chetan1981Author Commented:
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
0
 
Atlanta_MikeCommented:
which table?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
chetan1981Author Commented:
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.
0
 
Atlanta_MikeCommented:
have you tried sp_helpuser? This is a better way to access the user information.
0
 
vijay4sqlCommented:
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
0
 
vijay4sqlCommented:
And you wont see those NULL values either...
thx
VJ
0
 
chetan1981Author Commented:
Thanks to both of you for helping
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now