SQL Server在儲存過程中查詢關鍵字
在儲存過程中查詢(搜尋,查詢)關鍵字
SQL 查詢儲存過程中出現過的文字怎麼查詢呢?
select b.name
from 資料庫名.dbo.syscomments a, 資料庫名.dbo.sysobjects b
where a.id=b.id and b.xtype='p' and a.text like '%key words%'
order by name
create PROCEDURE [dbo].[_searchSP]
@keywords nvarchar(100)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select b.name
from dbo.syscomments a, dbo.sysobjects b
where a.id=b.id and b.xtype='p' and a.text like '%' + @keywords+ '%'
order by name
END
go
create PROCEDURE [dbo].[_searchTableFunction]
@keywords nvarchar(100)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select b.name
from dbo.syscomments a, dbo.sysobjects b
where a.id=b.id and b.xtype='TF' and a.text like '%' + @keywords+ '%'
order by name
END
go