Abdul Rahman
Abdul Rahman

Reputation: 1384

How to get query strings in SQL Server Profiler

I am interested in profiling SQL Server database transactions that are being executed by a java application.

Particularly I am interested in finding out what queries (query strings) get executed as a part of the transaction.

Database I am using is SQL Server 2008.

Right now I am selecting Exec Prepared SQL event and Prepare SQL event in the profiler but that does not give me the query strings that are being executed by the application. I see a bunch of exec statements but nothing more. It doesn't have details as to what query was being executed.

Would anyone have an idea of how can I get access to the query strings?

Regards,

Upvotes: 1

Views: 4867

Answers (1)

granadaCoder
granadaCoder

Reputation: 27904

My typicals are:

RPC:Completed.
SP Completed.
SP:StmtCompleted

Exec Prepared SQL
SQL : BatchCompleted
SQL : StmtCompleted

And I pick the TextData columnn (and some others).

Do you know about DMV queries?

http://sqlserverperformance.wordpress.com/2008/01/21/five-dmv-queries-that-will-make-you-a-superhero/

http://sqlserverperformance.wordpress.com/2011/02/04/five-dmv-queries-that-will-make-you-a-superhero-in-2011/

Upvotes: 3

Related Questions