Solved

SQL 2000 sp_prepare and sp_execute

Posted on 2006-07-06
3
1,657 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
  • 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

864 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now