Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sp_execute ? Expand / Collapse
Author
Message
Posted Wednesday, February 04, 2004 10:30 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, May 19, 2004 8:44 AM
Points: 34, Visits: 1

When running profiler I have noticed that the sp_execute statement runs quite often.  I think the developers do this on purpose through ADO.  What I want to know is what statement or stored procedure is executing this sp_execute statement because after the statement all you have is a number and then parameters.  Can someone tell me how this number can be referenced?

 

Thanks,

Belinda




Post #98712
Posted Monday, February 09, 2004 8:00 AM
SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,039, Visits: 1
No one has responded to this topic yet. Even if you don't have a complete answer, the original poster will appreciate any thoughts you have!
Post #99317
Posted Monday, February 09, 2004 1:53 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, March 18, 2004 11:47 AM
Points: 71, Visits: 1

Here's some documentation for you.  It's not much.  Have you tried DBCC Inputbuffer(nn) where nn is the SPID?

-------------------------------------------
API System Stored Procedures

Users running SQL Profiler against ADO, OLE DB, ODBC, and DB-Library applications may notice the use of system stored procedures that are not covered in the Transact-SQL Reference. These stored procedures are used by the Microsoft OLE DB Provider for SQL Server, the SQL Server ODBC driver, and the DB-Library dynamic-link library (DLL) to implement the functionality of a database API. These stored procedures are simply the mechanism the provider or drivers use to communicate user requests to SQL Server. They are intended only for the internal use of the OLE DB Provider for SQL Server, the SQL Server ODBC driver, and the DB-Library DLL. Calling them explicitly from an SQL Server application is not supported.

The complete functionality from these stored procedures is made available to SQL Server applications through the API functions they support. For example, the cursor functionality of the sp_cursor system stored procedures is made available to OLE DB applications through the OLE DB API cursor properties and methods, to ODBC applications through the ODBC cursor attributes and functions, and to DB-Library applications through the DB-Library Cursor Library.

These system stored procedures support the cursor functionality of ADO, OLE DB, ODBC, and the DB-Library Cursor Library:

sp_cursorsp_cursorclosesp_cursorexecute
sp_cursorfetchsp_cursoropensp_cursoroption
sp_cursorpreparesp_cursorunprepare 

These system stored procedures support the prepare/execute model of executing Transact-SQL statements in ADO, OLE DB, and ODBC:

sp_executesp_preparesp_unprepare

The sp_createorphan and sp_droporphans stored procedures are used for ODBC ntext, text, and image processing.

The sp_reset_connection stored procedure is used by SQL Server to support remote stored procedure calls in a transaction.

The sp_sdidebug stored procedure is used by SQL Server for debugging Transact-SQL statements.

 




Post #99385
Posted Tuesday, February 10, 2004 12:43 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, September 23, 2009 9:40 AM
Points: 940, Visits: 54
sp_execute is a system stored procedure used with "prepared" statements from a client.  The number you see is an internal pointer to the execution plan on the server.  The values following that number are the parameters for a particular invocation of the prepared statement.  See Prepared Execution in BOL.



--Jonathan
Post #99607
Posted Wednesday, February 11, 2004 12:21 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, March 13, 2014 10:40 AM
Points: 1,035, Visits: 408
Unfortunately, MS has not provided us, the DBA's, a good way of actually seeing what SQL is actually being executed by sp_execute.  This makes troubleshooting and optimization very difficult at best and sometimes impossible.  This reason alone is enough to tell our developers not to use prepared statements.


/*****************

If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek



*****************/
Post #99894
Posted Tuesday, January 05, 2010 12:05 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 03, 2010 2:21 AM
Points: 1, Visits: 49
The solution

http://dbaspot.com/forums/ms-sqlserver/141465-how-can-i-find-out-what-command-sp_execute-running-without-using-profiler.html
Post #841868
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse