SELECT ROUTINE_NAME, P.PARAMETER_NAME FROM INFORMATION_SCHEMA.ROUTINES R INNER JOIN INFORMATION_SCHEMA.PARAMETERS P ON P.SPECIFIC_NAME = R.ROUTINE_NAME WHERE ( (LEN(OBJECT_DEFINITION(OBJECT_ID(R.ROUTINE_NAME)) ) - LEN(REPLACE(OBJECT_DEFINITION(OBJECT_ID(R.ROUTINE_NAME)) , P.PARAMETER_NAME, ''))) - LEN(P.PARAMETER_NAME) = 0) ORDER BY 1,2
http://csharpdeveloper.wordpress.com/2011/12/10/find-stored-procedures-that-are-not-using-all-the-parameters-passed-into-them-sql-server/
0 comments:
Post a Comment