O'Reilly logo

Microsoft SQL Server 2014 Unleashed by Paul Bertucci, Alex T. Silverstein, Chris Gallelli, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 system views. The following sections describe these methods.

Using T-SQL to View Functions

There are multiple methods to view the source code for a user-defined function. One way is to use the sp_helptext procedure:

use AdventureWorks2012goexec sp_helptext getonlydatego/* resultText--------------------------------------------------------------------CREATE FUNCTION getonlydate ()RETURNS datetimeASBEGIN   RETURN (select convert(datetime, convert(date, getdate())))END*/

Note

To display ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required