Day 20. User-Defined Functions in SQL

In every programming language, there is a group of prewritten routines that can be used by anyone using the language. These routines are called built-in functions. During most of this book, you have used or have seen many of the functions available to you when coding T-SQL scripts. However, there probably will be many times when these functions do not supply the functionality you need.

When you start writing complex T-SQL applications, you will find that many of the actions and calculations that you perform are repetitive. Of course, you could decide to use stored procedures to perform some of these tasks, but you might also want to consider creating your own functions so that you can then use them elsewhere ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition 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.