您的位置:首页 > 数据库

SQL SERVER 中通过存储过程名称找对应的数据库

2018-03-21 18:35 411 查看
declare @procName nvarchar(max) = ‘GSP_GP_EfficacyAccounts_test’;

declare @procSql nvarchar(max) =’if exists(select 1 from [?].sys.objects where name=”’+@procName+”’)

select ”?” as 数据库名称,name as 存储过程名称 from [?].sys.objects where name=”’+@procName+””;

EXEC sp_msforeachdb @procSql
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息