什么查询可以返回SQL Server数据库中所有存储过程的名称
如果查询可以排除系统存储过程,那将更有帮助。
什么查询可以返回SQL Server数据库中所有存储过程的名称
如果查询可以排除系统存储过程,那将更有帮助。
当前回答
select * from DatabaseName.INFORMATION_SCHEMA.ROUTINES where routine_type = 'PROCEDURE'
select * from DatabaseName.INFORMATION_SCHEMA.ROUTINES where routine_type ='procedure' and left(ROUTINE_NAME,3) not in('sp_', 'xp_', 'ms_')
SELECT name, type FROM dbo.sysobjects
WHERE (type = 'P')
其他回答
这也可以帮助列出除了系统过程之外的过程:
select * from sys.all_objects where type='p' and is_ms_shipped=0
这将只给出存储过程的名称。
select specific_name
from information_schema.routines
where routine_type = 'PROCEDURE';
试试这个codeplex链接,这个实用程序帮助本地化sql数据库中的所有存储过程。
https://exportmssqlproc.codeplex.com/
这个,列出所有你想要的东西
在Sql Server 2005, 2008, 2012:
Use [YourDataBase]
EXEC sp_tables @table_type = "'PROCEDURE'"
EXEC sp_tables @table_type = "'TABLE'"
EXEC sp_tables @table_type = "'VIEW'"
OR
SELECT * FROM information_schema.tables
SELECT * FROM information_schema.VIEWS
获取对象的最佳方法是使用sys.sql_modules。您可以从这个表中找到所需的所有内容,并通过object_id将这个表与其他表连接起来以获取更多信息
SELECT o. object_id,o.name AS name,o.type_desc,m.definition,schemas.name scheamaName
FROM sys.sql_modules m
INNER JOIN sys.objects o ON m.object_id=o.OBJECT_ID
INNER JOIN sys.schemas ON schemas.schema_id = o.schema_id
WHERE [TYPE]='p'