N_Sri
asked on
Finding SP which uses particular table and column
Hi ,
Please help me to write this query.
Query to find all the SPs : which use table "xyz " and column "abc" in that table .
Example think that there is table Employee with Fields Name, Age,Id, IsActive.
so this table is used in SPs like SP_emp,Sp_Names,SP_Empee
so here SP_Emp will use table "xyz" and column "abc" i.e SP has some code with table " xyz" and column " abc"
Well I want to have query so that I can find all the SPs with Table name as parameter and Column Name as paramater
Please help me to write this query.
Query to find all the SPs : which use table "xyz " and column "abc" in that table .
Example think that there is table Employee with Fields Name, Age,Id, IsActive.
so this table is used in SPs like SP_emp,Sp_Names,SP_Empee
so here SP_Emp will use table "xyz" and column "abc" i.e SP has some code with table " xyz" and column " abc"
Well I want to have query so that I can find all the SPs with Table name as parameter and Column Name as paramater
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT object_name(id) as 'Name', type_desc
FROM syscomments sc
Inner Join sys.objects so
ON sc.id = so.object_id
WHERE CONTAINS([text], 'CreateUser') --[text] LIKE '%CreateUser%' --> here where you pass in variable for table name of column name
and so.type IN( 'SP')
FROM syscomments sc
Inner Join sys.objects so
ON sc.id = so.object_id
WHERE CONTAINS([text], 'CreateUser') --[text] LIKE '%CreateUser%' --> here where you pass in variable for table name of column name
and so.type IN( 'SP')
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thankyou.. result set is not giving improper information
ASKER
Above solution is not working for my requirment.