使用 t-sql 检索过滤的存储过程列表 [英] Retrieving a filtered list of stored procedures using t-sql

查看:37
本文介绍了使用 t-sql 检索过滤的存储过程列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取 t-sql 中的存储过程列表.我正在使用该行:

I'm trying to get a list of stored procedures in t-sql. I am using the line:

exec sys.sp_stored_procedures;

虽然我想过滤结果,所以我只获取用户创建的存储过程.我想过滤掉 sp_*、dt_*、fn_*、xp_* 和所有其他系统存储过程,我不感兴趣.如何操作返回的结果集?

I would like to filter the results back though, so I only get user created stored procedures. I would like to filter out sp_*, dt_*, fn_*, xp_* and everything else that is a system stored procedure and no interest to me. How can I manipulate the result set returned?

使用 Sql Server 2008 express.

Using Sql Server 2008 express.

解决了!这是我使用的:

Solved! Here is what I used:

SELECT name FROM sys.procedures
WHERE [type] = 'P'
AND name NOT LIKE 'sp_%'
AND name NOT LIKE 'dt_%'
ORDER BY name ASC;

推荐答案

您可以使用以下视图,而不是使用存储过程:

Rather than using the Stored Procedure you can use the following views:

Select * From sys.procedures
Where [Type] = 'P'

Select * From Information_Schema.Routines

这篇关于使用 t-sql 检索过滤的存储过程列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆