For a given stored procedure, I want the following summary –
- Tables selected with column names
- Tables modified (insert, update or delete) with column names (if update)
- Any child stored procedure being called with same summary as above two points.
- Parameters passed
Does anyone know such a T-SQL script to summarize a stored procedure?
You can use
sp_helpto get information about with parameters and information about the object.Then to get what it is using for tables and columns you can use
sp_dependsHere is a useful link that list the sql Object Dependencies
Or you can also use. But it is only for 2008 and above.
because
sp_dependsis deprecated.If the store procedure are using dynamic sql. Then the only you have to use:
This will return the content of the procedure.
If you have Dynamic sql in you store procedure. You could do something like this:
This will return the objects used in the store procedure.