How to view a stored function - SQL Server

后端 未结 7 2438
陌清茗
陌清茗 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条回答
  •  萌比男神i
    2020-12-28 17:29

    You can use sp_helptext command to view the definition. It simply does

    Displays the definition of a user-defined rule, default, unencrypted Transact-SQL stored procedure, user-defined Transact-SQL function, trigger, computed column, CHECK constraint, view, or system object such as a system stored procedure.

    E.g;

    EXEC sp_helptext 'StoredProcedureName'

    EDIT: If your databases or server are different then you can do it by specifying them as well

    EXEC [ServerName].[DatabaseName].dbo.sp_helptext 'storedProcedureName'
    

提交回复
热议问题