查看存储过程定义

查看存储过程定义

方法1.系统存储过程: sp_helptext

USE AdventureWorks2012;  
GO  
EXEC sp_helptext N'AdventureWorks2012.dbo.uspLogError';

方法2.系统函数:OBJECT_DEFINITION

USE AdventureWorks2012;  
GO  
SELECT OBJECT_DEFINITION (OBJECT_ID(N'AdventureWorks2012.dbo.uspLogError'));

方式3.sys.sql_modules 目录视图: sys.sql_modules

USE AdventureWorks2012;  
GO  
SELECT definition  
FROM sys.sql_modules  
WHERE object_id = (OBJECT_ID(N'AdventureWorks2012.dbo.uspLogError'));
原文地址:https://www.cnblogs.com/Vincent-yuan/p/12616591.html