Quantcast
Channel: Questions in topic: "system-stored-proc"
Viewing all articles
Browse latest Browse all 4

find out what table a stored procedure updates,inserts to, modifies

$
0
0
I want to be able to be able to filter the results of this query to in include only SprocName that has an INSERT or Update or Modify statement in them. Is there a way to do that? I was tasked with finding out what table each stored procedure writes to. Server 2005 btw SELECT DISTINCT QUOTENAME(OBJECT_SCHEMA_NAME (referencing.object_id)) + '.' + QUOTENAME(OBJECT_NAME(referencing.object_id)) AS SprocName ,QUOTENAME(OBJECT_SCHEMA_NAME (referenced.object_id)) + '.' + QUOTENAME(OBJECT_NAME(referenced.object_id)) AS ReferencedObjectName ,referenced.type_desc AS ReferencedObjectType FROM sys.sql_dependencies d INNER JOIN sys.procedures referencing ON referencing.object_id = d.object_id INNER JOIN sys.objects referenced ON referenced.object_id = d.referenced_major_id WHERE referencing.type_desc = 'SQL_STORED_PROCEDURE' AND referenced.type_desc='USER_TABLE' Order BY SprocName,ReferencedObjectName ; Thank you in advance for your help.

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images