0

How to see content/description of a function in SQL Server

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ali Karaca
  • 3,365
  • 1
  • 35
  • 41

3 Answers3

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

You can use sp_helptext like

sp_helptext procedure_name
Rahul
  • 76,197
  • 13
  • 71
  • 125
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  

https://learn.microsoft.com/en-us/sql/relational-databases/user-defined-functions/view-user-defined-functions?view=sql-server-2017

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