About
Pricing
Community
Teams
Start Free Trial
Log in
GreggPeele
asked on
12/26/2012
Find database that have a specific stored proc
I need a line of SQL that will return only the databases on my SQL Server instance that have a specific stored procedure defined. If the proc is named "sp_custom_proc", how would I enumerate all the databases where that proc is defined?
Microsoft SQL Server
3
2
Last Comment
GreggPeele
8/22/2022 - Mon
SOLUTION
Steve Wales
12/26/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Alpesh Patel
12/26/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
GreggPeele
12/27/2012
ASKER
Another option...
CREATE TABLE #x(db varchar(30), obj SYSNAME);
EXEC sp_msforeachdb
@command1 ='INSERT #x SELECT ''?'',name
FROM ?.sys.procedures
WHERE name =''PX_ReleaseBOL37'';';
SELECT * FROM #x;
DROP TABLE #x;
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
CREATE TABLE #x(db varchar(30), obj SYSNAME);
EXEC sp_msforeachdb
@command1 ='INSERT #x SELECT ''?'',name
FROM ?.sys.procedures
WHERE name =''PX_ReleaseBOL37'';';
SELECT * FROM #x;
DROP TABLE #x;