Home > Archive > MS SQL Server Tools > January 2006 > Listing prepared statements...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Listing prepared statements...
Mark

2006-01-26, 4:58 pm

Hi...

I've noticed when using Microsoft SQL Profiler, when prepared statements are
in use, yields only such information as "sp_execute 3, 12, 34" etc. This
contrasts with using stored procedures, whereby I get the entire "Select"
statement in the profiler output.

I know if I enable events in the profiler, such as TSQL>Exec Prepared SQL
and TSQL>Prepare SQL, I get to see the initial preparation of the statement,
and I'm able to resolve statement handle does what. (For example, in my
example above, what does statement '3' actually do?)

But what about if I start the profiler AFTER the statements have been
prepared (and assigned to their various numeric handle numbers)?

Is there a query or method by which I can display all currently-prepared SQL
statements?

Thanks for any help,
Mark.


David Gugick

2006-01-26, 8:23 pm

Mark wrote:
> Hi...
>
> I've noticed when using Microsoft SQL Profiler, when prepared
> statements are in use, yields only such information as "sp_execute 3,
> 12, 34" etc. This contrasts with using stored procedures, whereby I
> get the entire "Select" statement in the profiler output.
>
> I know if I enable events in the profiler, such as TSQL>Exec Prepared
> SQL and TSQL>Prepare SQL, I get to see the initial preparation of the
> statement, and I'm able to resolve statement handle does what. (For
> example, in my example above, what does statement '3' actually do?)
>
> But what about if I start the profiler AFTER the statements have been
> prepared (and assigned to their various numeric handle numbers)?
>
> Is there a query or method by which I can display all
> currently-prepared SQL statements?
>
> Thanks for any help,
> Mark.


You might be able to have a look in master..syscacheobjects. Try
filtering on the objtype column for "Prepared statement".


--
David Gugick
Quest Software
www.quest.com

Mark

2006-01-28, 7:23 am

Thanks David,

I'll give it a try.

Mark.

"David Gugick" <david.gugick-nospam@quest.com> wrote in message
news:OEuWHctIGHA.1028@TK2MSFTNGP11.phx.gbl...
> Mark wrote:
>
> You might be able to have a look in master..syscacheobjects. Try
> filtering on the objtype column for "Prepared statement".
>
>
> --
> David Gugick
> Quest Software
> www.quest.com
>



Mark

2006-01-28, 7:23 am

David,

Again, thank you very much, fantastic! Yes, you're right, there in
syscacheobjects is the SQL statement and dbid related to prepared
statements.

Mark.

"David Gugick" <david.gugick-nospam@quest.com> wrote in message
news:OEuWHctIGHA.1028@TK2MSFTNGP11.phx.gbl...
> Mark wrote:
>
> You might be able to have a look in master..syscacheobjects. Try
> filtering on the objtype column for "Prepared statement".
>
>
> --
> David Gugick
> Quest Software
> www.quest.com
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com