How to see content/description of a function in SQL Server
Asked
Active
Viewed 3,074 times
0
-
https://stackoverflow.com/a/15162504/9753352 – Hagai Wild Aug 09 '18 at 13:25
-
http://idownvotedbecau.se/noresearch/ Don't post and then answer your own question when the answer you provide is an exact dupe of an existing SO post. – dfundako Aug 09 '18 at 13:53
3 Answers
0
sp_helptext N'objectName'
objectName can be a stored procedure or a function name

Yogesh Sharma
- 49,870
- 5
- 26
- 52

Ali Karaca
- 3,365
- 1
- 35
- 41
0
below is an example you can follow this
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

Zaynul Abadin Tuhin
- 31,407
- 5
- 33
- 63