Viewing and Modifying User-Defined Functions

Besides using T-SQL commands to create functions, you can also use them to view and modify functions. You can get information by using the provided system procedures and queries against the INFORMATION_SCHEMA.routines view. The following sections describe these methods.

Using T-SQL to View Functions

To view the source code for a user-defined function, you can use the sp_helptext procedure:

image

Note

To display the source code for the functions clearly, configure the SSMS query window to display results as text rather than in the grid by pressing Ctrl+T.

In addition to sp_helptext, you can write queries ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.