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

Comments

Popular posts from this blog

Always On FailOver Events

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period