on 2013 May 28 10:07 AM
I have some stored procedures that i would like to know how gets called. Is it possible to get the query that gets executed from inside the procedure?
EX SELECT PROPERTY('QUERY')
Request clarification before answering.
You can see the text of stored procedures by viewing the SYS.SYSPROCEDURE system view.
e.g. To see the text for a stored-procedure "sp_targetsp()":
SELECT proc_defn FROM SYS.SYSPROCEDURE WHERE proc_name = 'sp_targetsp'
You may also need to filter by "owner" if there are multiple stored procedures with the same name created by different database users.
If you'd like to see what is being executed inside of a stored procedure at runtime, you can monitor these statements using request-level logging:
dbsrv16 -zr SQL+PROCEDURES -zo rll.txt ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
16 | |
12 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.