Posts

Showing posts from October, 2024

How to push or capture sp_WhoisActive result set to a table.

The query below will explain you how to create a table  and push the data to capture sp_WhoIsActive result set into a table. /* The script below will provide CREATE TABLE script to capture sp_whoisactive result set.After you run the script copy the result to a new query a window and provide an appropriate name to the table and create table. */ DECLARE @S VARCHAR(MAX) EXEC sp_WhoIsActive @return_schema = 1, @get_plans = 1, @schema = @s OUTPUT SELECT @s /* Once the table got created push the result to that table by executing below script. If you want to capture data for every 5 minutes create a job and place it there. */ EXEC sp_WhoIsActive @destination_table = 'northwind.dbo.WhoisActive' , @get_plans =1