0

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

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Ali Karaca
  • 2,695
  • 31
  • 35

3 Answers3

0
sp_helptext N'objectName'

objectName can be a stored procedure or a function name

Yogesh Sharma
  • 49,081
  • 5
  • 23
  • 49
Ali Karaca
  • 2,695
  • 31
  • 35
0

You can use sp_helptext like

sp_helptext procedure_name
Rahul
  • 73,987
  • 13
  • 62
  • 116
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://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/view-user-defined-functions?view=sql-server-2017

Zaynul Abadin Tuhin
  • 30,345
  • 5
  • 25
  • 56