I want to use one stored procedure or any other object name contains 'Blog' from current Server or Instance.
But, I don't know where is/are the procedure or object actually exists! or In which database ?
Is there any way to search an object in all the databases in current Instance ?
Use Master
Go
Declare @WhereIs Table
(DBName Varchar(100),
ObjectName Varchar(150),
ObjectType Varchar(150)
)
Insert @WhereIs
Exec sp_msforeachdb 'use [?]; select DB_NAME(), name, Type_desc from sys.objects where name like ''%Blog%'''
Select * from @WhereIs
Go
But, I don't know where is/are the procedure or object actually exists! or In which database ?
Is there any way to search an object in all the databases in current Instance ?
Use Master
Go
Declare @WhereIs Table
(DBName Varchar(100),
ObjectName Varchar(150),
ObjectType Varchar(150)
)
Insert @WhereIs
Exec sp_msforeachdb 'use [?]; select DB_NAME(), name, Type_desc from sys.objects where name like ''%Blog%'''
Select * from @WhereIs
Go
No comments:
Post a Comment