【发布时间】:2018-08-09 13:23:32
【问题描述】:
如何在 SQL Server 中查看函数的内容/描述
【问题讨论】:
-
idownvotedbecau.se/noresearch 当您提供的答案完全是对现有 SO 帖子的欺骗时,不要发布然后回答您自己的问题。
标签: sql sql-server
如何在 SQL Server 中查看函数的内容/描述
【问题讨论】:
标签: sql sql-server
以下是您可以遵循的示例
USE AdventureWorks2012;
GO
-- Get the function name, definition, and relevant properties
SELECT sm.object_id,
OBJECT_NAME(sm.object_id) AS object_name,
o.type,
o.type_desc,
sm.definition,
sm.uses_ansi_nulls,
sm.uses_quoted_identifier,
sm.is_schema_bound,
sm.execute_as_principal_id
-- using the two system tables sys.sql_modules and sys.objects
FROM sys.sql_modules AS sm
JOIN sys.objects AS o ON sm.object_id = o.object_id
-- from the function 'dbo.ufnGetProductDealerPrice'
WHERE sm.object_id = OBJECT_ID('dbo.ufnGetProductDealerPrice')
ORDER BY o.type;
GO
【讨论】:
sp_helptext N'objectName'
objectName 可以是存储过程或函数名
【讨论】:
你可以像sp_helptext一样使用
sp_helptext procedure_name
【讨论】: