微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐