加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

SQL Server在存储过程中查询关键字

发布时间:2023-03-09 09:43:09 所属栏目:教程 来源:
导读:在存储过程中查找(搜索,查询)关键字

sql 查找存储过程中出现过的文字怎么查询呢?
select b.name
from 数据库名.dbo.syscomments a, 数据库名.dbo.sysobjects b
where a.id=b.id and b.xtype='p' and
在存储过程中查找(搜索,查询)关键字

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
 

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章