SQL Server Profile - View Parameter Values?

可紊 提交于 2019-11-29 13:49:53

问题


In SQL Server Profile, I have it tracing SP:StmtStarting events. The "TextData" includes information like the following:

EXEC MySortedProc 
   @param, NULL,
   @param2, NULL

What would I have to trace (or can I?) to view the value of those parameters?


回答1:


Somewhat scared to have misunderstood the question, but you could profile on the RPC:Completed event which will return the result for stored procedure execution in the textdata column like:

exec usp_yourproc @param = 'value'




回答2:


If I get you correctly, you have a stored procedure being called by another stored procedure and you want to get the values of your parameters that are being passed to the inner stored procedure?

I don't think it's possible with SQL Profiler. If I find a way though, I'll post an update. If this is just for debugging then you can save the values into a table to check after the fact, but that's not a very good production solution unless you really want that kind of extensive logging.




回答3:


For some evensts, SQL Profiler will show NULL values instead of real datain TextData column. You could a metod that is explained below article to capture this info. I used this method to capture another set of queries that were throwing sort warnings. Let me know if this helps.

http://sankarreddy.spaces.live.com/blog/cns!1F1B61765691B5CD!367.entry



来源:https://stackoverflow.com/questions/357283/sql-server-profile-view-parameter-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!