Solved

SQL 2000 sp_prepare and sp_execute

Posted on 2006-07-06
3
1,688 Views
Last Modified: 2012-06-22
Does anyone know if you can view all the sp_prepare statements and their handler numbers, or view them by a handler number in SQL using either query analyzer or Enterprise Manager?

There are a lot of sp_execute commands being run, and I need to see the prepare statements.  Using profiler is only showing me the execute statements.

Thanks.
0
Comment
Question by:TheTull
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 17052048
You can do this

Run

SELECT * from master..sysprocesses

find the handle associated with the processid

and pass this processId

SELECT * from ::fn_get_sql(0x0100070017FF762CC040891A0000000000000000)
0
 
LVL 7

Author Comment

by:TheTull
ID: 17052677
If I understand you correctly, you mean get the SPID of the sp_execute process, then find the sql_handle and use that number in the second select statement you gave me?

If that's the case, then the sql_handle I get from the sysprocesses table is all 0s, so I don't know if I am misunderstanding you or not,

thanks for the help too.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17166178
>you mean get the SPID of the sp_execute process
NO, Both SPID and SID are different

Select sid, SPID from master..sysprocesses
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question