declare @dbid int
set @dbid=db_id('dbName')
select distinct hostname,
db_name(dbid),
net_address,
loginame,
program_name
from master..sysprocesses
where hostname!=''and(@dbid is null or dbid=@dbid)
查询结果:
2022-10-16 18:14:41
declare @dbid int
set @dbid=db_id('dbName')
select distinct hostname,
db_name(dbid),
net_address,
loginame,
program_name
from master..sysprocesses
where hostname!=''and(@dbid is null or dbid=@dbid)
查询结果: