I did ask this before. But here is what I would like to do –
I would like to run my .net application and monitor the sql queries being done and monitor only those as compared to sql profiler which logs everything.
So, does anyone know of a tool or a way I can monitor queries for an application and then find out the most expensive queries of that session ?
In your applications connection string to SQL Server, add (OTTOMH) APPLICATION_NAME = ‘ABC App’. So in effect it should be like
‘Server=YOURSERVERNAME;Integrated Security=SSPI;Application_Name=ABC App’
Once your app is running, you can run
sp_who2in SQL Server Management Studio to view all the connections – check there to make sure that your application is showing up with the name rather than the generic name for .Net apps.*Double check if this is App Name or Application_Name*
When you are setting up the trace flags in Profiler, go to the Events tab, and click on Column Filters. The first one is for the ApplicationName. Set that to ‘%ABC App%’