Atom
Atom

Reputation: 350

How to check a log of stored procedure calls?

Is there some type of logging in SQL Server (or some way to enable simple logging) that would allow me to check if a stored procedure was called, when it was called, and what parameters were passed and returned? I have seen some addon scripts for this but wasn't sure if this was built into SQL Server?

Upvotes: 10

Views: 27125

Answers (3)

anon
anon

Reputation:

There is not much built in for this. If you are using recent versions of SQL Server (your question is not very precise on this point), you can look at the DMV sys.dm_exec_procedure_stats, but it will not have individual calls, just aggregates.

If you are interested in a particular stored procedure, you could run a very targeted server-side trace server-side trace. (Sorry, since Quest decided to kill SQLServerPedia, I can't find the original post I referenced).

I wrote an article about building your own logging and adding it to n stored procedures:

You could easily expand that to include the parameters called.

Upvotes: 6

gbn
gbn

Reputation: 432261

It isn't built in

You need to set up a profiler trace or add code to your stored procedures to log

Upvotes: 8

JohnD
JohnD

Reputation: 14757

You can do this with the SQL Server Profiler tool:

http://msdn.microsoft.com/en-us/library/ms187929.aspx

Upvotes: 4

Related Questions