Technical Article

List the current user list on given database

,

How to get a list of the users logged on to a specific database ? (instead of SP_WHO)

Declare @DbName sysname

select @DbName =<< DB NAME >>

select sp.loginame, sp.hostname, sp.login_time, sp.last_batch
from master..sysprocesses sp, master..sysdatabases sd
where sp.dbid = sd.dbid and sd.name = @DbName

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating