I need the query or code in SQL Server to get all the stored procedures in which table is being used in the server (need all stored procedures in all databases on that server).
SELECT *
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%[dbo].[Batch]%.
Above query will give in the current database but I need the query to get from all the databases in that server.
Thanks. Sandeep
Try this:
select * from sysobjects where id in
(select id from syscomments where text like '%myquery%')
order by [name]
where "myquery" is the name of the table. You need to run this on each database on the server individually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With