gordon613
gordon613

Reputation: 2952

How can I profile the SELECT statements inside stored procedures when using SQL Server Profiler for Azure Data Studio on an Azure SQL Database?

The SQL Server Profiler for Azure Data Studio shows stored procedures, when connected to an Azure SQL Database.

enter image description here

Is it possible to profile the SELECT statements inside the stored procedures?

Is the reason why I seem unable to do it because there is only one (limited) template provided with the profiler when accessing Azure SQL Database?

Upvotes: 2

Views: 854

Answers (1)

Grant Fritchey
Grant Fritchey

Reputation: 2795

The SQL Server Profiler GUI within Azure Data Studio is just a front-end for Extended Events. If you want to set up different data collection, such as sp_statement_completed to see individual statements within procedures, you just have to define an Extended Events session with that event and you're good to go. Here are the basics to get that done. Instead of the SSMS GUI, use the "Corresponding T-SQL" section as the guide for creating your own session. You may also want to correlate the individual statements with the start & stop of the procedure itself, rpc_starting and rpc_completed. In that case, use Causality Tracking as I show it here on my blog. Then, you can query the XML output, or, use another tool to consume the information (I do prefer DBATools for that approach).

That should give you everything you need.

Upvotes: 4

Related Questions