Developers, use Profiler to profile yourself


You’re starting to work on an existing application that doesn’t have sufficient documentation.  You need to trace the current flow to understand and review all SQL calls during the lifecycle of the application (RPC:Complete and SQL:BatchCompleted).  You know that SQL Profiler can do this but you’re unsure how to make use of the filter options.


In order to solve the following problem you would want to use SQL Profiler.  Start a new trace and in the event selection deselect all events other than RPC:Completed and SQL:BatchCompleted.


Next check the checkbox to show all columns so we can add a few columns that are left off by default.  Now scroll to the right and you will notice many columns that could be helpful.  For example, I see DatabaseName, HostName, and NTLoginName.  Place a check in the checkbox for these columns.

Now we will move along to filters.  Click on the Column Filters button.  Notice that the columns you just added are also candidates for filtering.  In this example I am going to select HostName and use my computer name “WHBV53YC1” (You could also use NTUserName and use your login name)


Its that simple, you just configured the trace to only capture Stored Procedures and TSQL commands issued by yourself.