5

sp_who2

 3 years ago
source link: https://blog.sqlauthority.com/2020/12/29/sql-server-sp_who2-parameters/?utm_campaign=sql-server-sp_who2-parameters
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Earlier I had written a blog post about SQL SERVER – Representing sp_who2 with DMVs and SQL SERVER – Inserting sp_who2 Into a Table. One of my clients asked me a follow-up question in the Comprehensive Database Performance Health Check. The question was about sp_Who2 parameters. Let us learn about them today.

SQL SERVER - sp_who2 Parameters sp_who2parameters-800x354

Just like sp_who the stored procedure sp_who2 also accepts similar parameters. Let us see a few of the examples.

User Specific Process via Parameters

USE master; 
GO 
EXEC sp_who 'sqlauthority'
GO

Display Specific Session ID

USE master; 
GO 
EXEC sp_who '102'
GO

Display Only Active Sessions

USE master; 
GO 
EXEC sp_who 'active'
GO

Well, that is for today. Let me know if you know any other trick with sp_who2. While there are many advanced scripts out there, I still see lots of users using the sp_who2 to gain additional insight into their system.

Here are a few recent blog posts on the same topic which you may find interesting:

Let me know what you think of this blog post and if you want me to create a SQL in Sixty Seconds post for this video. If you have a similar script that you may find will be helpful to users, please do share it with me and I will post it on the blog with due credit to you.

You can always reach out to me via Twitter here.

Reference: Pinal Dave (https://blog.sqlauthority.com)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK