How to view a stored function - SQL Server

后端 未结 7 2453
陌清茗
陌清茗 2020-12-28 17:03

Version: SQLServer 8

I would like to view the contents of a stored function in sqlserver, i.e. what exactly the function is doing.

None of the options listed

7条回答
  •  盖世英雄少女心
    2020-12-28 17:54

    --ShowStoredProcedures
    select p.[type]
          ,p.[name]
          ,c.[definition]
      from sys.objects p
      join sys.sql_modules c
        on p.object_id = c.object_id
     where p.[type] = 'P'
       --and c.[definition] like '%foo%'
    ORDER BY p.[name]
    ___________
    
    SELECT OBJECT_NAME(object_id) ProcedureName,
           definition
    FROM sys.sql_modules
    WHERE objectproperty(object_id,'IsProcedure') = 1
    ORDER BY OBJECT_NAME(object_id)
    

提交回复
热议问题