I would like to create a generic logging solution for my stored processes, so that I can log the value of the input parameters. Currently I am doing more or less by hand and I am very unhappy with this view. Ideally, I would like to say something like the following:
"What is my input parameter, my input parameters and their value?"
This is the same information that has been revealed to me. I run SQL Profiler - the name of the stored procedure, all input parameters and all input values are listed for me. How do I get these values from a stored procedure? Can i do
Thanks; Duncan
It would be difficult to do this within a stored procedure. SQL Profiler runs under a separate SPID and runs a statement like this to capture other users' statements:
DECLARE @handle vARBINARY (64) SELECTS_handle = sql_handle sys. From sysprocesses where spid = @ SPID SELECT text from sys.dm_exec_sql_text (@handle)
The problem is that if you run it in a stored proc for the current SPID then all your Returning statement is the above statement I do not believe that SQL Server Minister-SQL provides to execute a batch under a different Spiaidi. I think you can write a .NET dll archived procedure that performs a batch on a separate network. To do this work, but it can cause more problems.
Comments
Post a Comment