SQL Server: Filter output of sp_who2

后端 未结 13 2095
长情又很酷
长情又很酷 2020-12-02 03:49

Under SQL Server, is there an easy way to filter the output of sp_who2? Say I wanted to just show rows for a certain database, for example.

13条回答
  •  执念已碎
    2020-12-02 04:34

    This is the solution for you: http://blogs.technet.com/b/wardpond/archive/2005/08/01/the-openrowset-trick-accessing-stored-procedure-output-in-a-select-statement.aspx

    select * from openrowset ('SQLOLEDB', '192.168.x.x\DATA'; 'user'; 'password', 'sp_who') 
    

提交回复
热议问题