richa verma
richa verma

Reputation: 287

How to map a SQL profiler captured 'exec sp_executesql' to stored procedure name in sql server

I have a huge SQL server database. I want to re-write an application. For that I want to reuse the database which has many tables, views and stored procedure. I am using SQL Profiler tool to map the application functionality to database. In Profiler, I am capturing

SP:Starting 
SP:Completed 
SP:StmtStarting 
RPC:Completed
SQL:BatchCompleted 
SQL:BatchStarting

In my Profiler trace I have captured an RPC:Completed event class and the textdata contains

exec sp_executesql N'Select Some query' @var=N'value'".

What is sp_executesql and how can I know the exact name of the stored procedure called?

Upvotes: 2

Views: 1943

Answers (1)

Harshad Vekariya
Harshad Vekariya

Reputation: 1052

In your trace you need to add additional column ObjectName which show exact sproc name when you click on RPC:Completed event. ObjectName can be seen when you check 'Show all columns'

enter image description here

Upvotes: 2

Related Questions