views:

19

answers:

1

is there a way to make a query which DB the Stored Procedure is located? I got this bunch of Databases doing a lot of Cross DB query from each other, now I got lost with 1 stored procedure and I just want to look from which DB it is located. I want to make a script that will return the DB name of where that stored procedure is located.

Is this possible?

+1  A: 

Look to this question http://stackoverflow.com/questions/219434/query-that-returns-list-of-all-stored-procedures-in-an-ms-sql-database

Michael Pakhantsov
can't we do just like `select * from information_schema.blah where procedure_name = 'procedure_name'` and this will search to all the databases?
rob waminal
No it will search only inside particular database (if not specified then will used current). However you can create a view, if you know list of databases, which you use. And try search in the view.
Michael Pakhantsov