Wednesday, October 26, 2011

How to find if a particular field used in SQL SPs

If you want to find if a particular field been used in Stored Procedure , you can do this using the INFORMATION_SCHEMA.ROUTINES view and filter based on the ROUTINE_TYPE='PROCEDURE' , following query will search to find if field1 been used in any stored procedure in the database.

SELECT ROUTINE_NAME, ROUTINE_DEFINITION 
FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_DEFINITION LIKE '%field1%'     
AND ROUTINE_TYPE='PROCEDURE'

No comments:

Post a Comment

SSRS - How to Parameterizing the SQL Query

We need to create separated dataset to handle the pre defined list in that dataset we will use simple select statement to define the li...