我的问题是:如果我写这样的商店程序:
create procedure test
as
begin
select * from databasename..Tablename
end
create procedure test1
as
begin
select * from databasename..Tablename
end
然后如何从两个程序上面找到databasename..
?我需要一个查询来查找像Databasename..tablename
这样使用的过程名称列表。在程序内部
答案 0 :(得分:0)
试试这个:
create procedure test
as
begin
select * from databasename..Tablename
end
GO
create procedure test1
as
begin
select * from databasename..Tablename
end
GO
DECLARE @SearchWord NVARCHAR(128) = 'databasename..Tablename'
SELECT ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%'+@SearchWord+'%'
UNION
SELECT OBJECT_NAME(id)
FROM SYSCOMMENTS
WHERE [text] LIKE '%'+@SearchWord+'%'
GROUP BY OBJECT_NAME(id)
UNION
SELECT OBJECT_NAME(object_id)
FROM sys.sql_modules
WHERE definition LIKE '%'+@SearchWord+'%'