shyamaladevib
asked on
Query to find if a stored procedure is being used anywhere else and also to find table in a server
Hi Experts,
I would need help with a query that can find if a stored procedure is being used in another stored procedure or any DTS packages for a given server.
And aslo would need help with query to find a table in a given server not just find in a database.
Thanks!
I would need help with a query that can find if a stored procedure is being used in another stored procedure or any DTS packages for a given server.
And aslo would need help with query to find a table in a given server not just find in a database.
Thanks!
This is one approach to find table 'table_name' in an entire server:
You can, of course, remove the else statement if you don't want to be bothered with all the places it doesn't exist.
You can, of course, remove the else statement if you don't want to be bothered with all the places it doesn't exist.
sp_msforeachdb '
use ?
if exists(
select * from information_schema.tables
where table_name = ''table_name''
)
print ''Table table_name exists in ?''
else
print ''Table table_name does not exist in ?''
'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
Replace the search string with your actual Stored Procedure name
Raj
Open in new window