cnblogs/dcrenl/sp_who 查看数据库连接数.html
2024-09-24 12:43:01 +08:00

10 lines
476 B
HTML

<div id="sina_keyword_ad_area2" class="articalContent ">
<div>create table #TempTable(spid int,ecid int,statusvarchar(32),loginname varchar(32),hostname varchar(32),blkint,dbname varchar(32),cmd varchar(32),request_idint);&nbsp;<wbr></div>
<div>insert into #TempTable&nbsp;<wbr></div>
<div>exec sp_who;&nbsp;<wbr></div>
<div>select * from #TempTable where [dbname] = 'DataBaseName' andHostName = 'PCName'</div>
<div>drop table #TempTable&nbsp;<wbr></div>
</div>