什么查询可以返回SQL Server数据库中所有存储过程的名称
如果查询可以排除系统存储过程,那将更有帮助。
什么查询可以返回SQL Server数据库中所有存储过程的名称
如果查询可以排除系统存储过程,那将更有帮助。
当前回答
这也可以帮助列出除了系统过程之外的过程:
select * from sys.all_objects where type='p' and is_ms_shipped=0
其他回答
这将显示所有的存储过程和代码:
select sch.name As [Schema], obj.name AS [Stored Procedure], code.definition AS [Code] from sys.objects as obj
join sys.sql_modules as code on code.object_id = obj.object_id
join sys.schemas as sch on sch.schema_id = obj.schema_id
where obj.type = 'P'
你可以尝试这个查询来获取存储过程和函数:
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 name,type,type_desc
from sys.objects
where type in ('V','P')
order by name,type
在SQL server中选择存储过程列表。更多信息请参考这里: https://coderrooms.blogspot.com/2017/06/select-list-of-stored-procedure-in-sql.html
如果你使用的是SQL Server 2005,下面的操作可以正常工作:
select *
from sys.procedures
where is_ms_shipped = 0