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

Share

Share

Rate