Reputation: 343
Inside a stored procedure, how do I get the calling command line? So if my stored procedure was called like:
exec UPD_ProjectChecklistField @ProjectRecID = N'19',
@FieldName = N'chkProjectTags',
@Value = 1,
@UserID = N'jnelson'
Inside the proc I want to get that string so I can add it to some auditing. I know I could assemble it by hand but that would need to be customized in every single proc. Is there anything I can call (view, etc.) that would give me that? Kind of like an arguments list in most programming language functions like @args. I can get the proc name using OBJECT_NAME(@@PROCID) but need the whole call with parameters and values.
Any insight?
Upvotes: 2
Views: 355
Reputation: 31785
Inside the proc, no.
But you can capture stored procedure calls with Profiler.
Or, if you're only interested in calls that come from a specific application, the DAL would be a good place to handle this.
Upvotes: 1