什么查询可以返回SQL Server数据库中所有存储过程的名称
如果查询可以排除系统存储过程,那将更有帮助。
什么查询可以返回SQL Server数据库中所有存储过程的名称
如果查询可以排除系统存储过程,那将更有帮助。
当前回答
SELECT name,
type
FROM dbo.sysobjects
WHERE (type = 'P')
其他回答
根据我的理解,“首选”方法是使用information_schema表:
select *
from information_schema.routines
where routine_type = 'PROCEDURE'
USE DBNAME
select ROUTINE_NAME from information_schema.routines
where routine_type = 'PROCEDURE'
GO
这将在mssql上工作。
你可以尝试这个查询来获取存储过程和函数:
SELECT name, type
FROM dbo.sysobjects
WHERE type IN (
'P', -- stored procedures
'FN', -- scalar functions
'IF', -- inline table-valued functions
'TF' -- table-valued functions
)
ORDER BY type, name
只是名字:
SELECT SPECIFIC_NAME
FROM YOUR_DB_NAME.information_schema.routines
WHERE routine_type = 'PROCEDURE'
select *
from dbo.sysobjects
where xtype = 'P'
and status > 0