Main menu:

Site search

Categories

Archive

MSSQL and Stored Procedures

Have you ever wanted to get a list of every stored procedure (stored proc) on an sql server and which tables each corresponds with? I know that I have :-)

Try this bit of T-SQL code:

SELECT
“Table Name” = P.[name],
“Trigger Name” = O.[name],
“Trigger Date” = O.refdate
FROM
syscomments C
INNER JOIN sysobjects O ON (C.id = O.id)
INNER JOIN sysobjects P ON (O.parent_obj = P.id)
WHERE
O.xtype = ‘TR’ AND P.xtype = ‘U’

Write a comment