如何查看存储的函数 - SQL Server [英] How to view a stored function - SQL Server
问题描述
版本:SQLServer 8
Version: SQLServer 8
我想查看 sqlserver 中存储函数的内容,即该函数到底在做什么.
I would like to view the contents of a stored function in sqlserver, i.e. what exactly the function is doing.
此处列出的所有选项都不适合我.似乎没有任何名为 sys.objects 的数据库/表.我能够查询 information_table.routines 表,但它不包含我正在寻找的函数.我的函数位于:
None of the options listed here work for me. There doesn't appear to be any database/table called sys.objects. I was able to query the information_table.routines table, but that does not contain the function that I am looking for. My function is located in:
DBName.dbo.functionName
DBName.dbo.functionName
如何查看该函数的内容?
How can I view the contents of this function?
推荐答案
您可以使用 sp_helptext 命令查看定义.简直了
You can use sp_helptext command to view the definition. It simply does
显示用户定义的规则、默认的、未加密的 Transact-SQL 存储过程、用户定义的 Transact-SQL 函数、触发器、计算列、CHECK 约束、视图或系统对象(如系统存储过程)的定义.
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.
例如;
EXEC sp_helptext 'StoredProcedureName'
如果您的 databases
或 server
不同,那么您也可以通过指定它们来实现
If your databases
or server
are different then you can do it by specifying them as well
EXEC [ServerName].[DatabaseName].dbo.sp_helptext 'storedProcedureName'
这篇关于如何查看存储的函数 - SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!