Solved

SQL 2000 sp_prepare and sp_execute

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now