It was written quite a while ago but if you’re starting out using functions in T-SQL, it’s still a good resource. Except for the section on system UDFs the rest of the book remains correct. There just haven’t been that many changes in how functions work since SQL 2000.
Transact-SQL doesn’t always offer the functions needed for a project, but with user-defined functions, introduced in SQL Server 2000, programmers can create their own. Transact-SQL User-Defined Functions discusses creating, using, and managing user-defined functions and system user-defined functions. The first part of the book explains the SQL syntax required to create, manage, and use UDFs, while the second part describes the system UDFs that Microsoft has added to SQL Server as tools to implement SQL Server functionality.
Find out about the three types of UDFs and how to create and use them.
Learn how UDFs can be debugged with Query Analyzer and SQL Profiler.
Retrieve metadata about UDFs using system stored procedures, system functions, INFORMATION_SCHEMA views, and from SQL Server’s system tables.
See UDFs in action with practical examples of currency conversion, unit conversion, report generation and performance analysis.
Learn what you can’t do in a user-defined function and about why not.
Learn to use documented and undocumented extended stored procures in UDFs.
Discover how to use system UDFs including undocumented system UDFs. Learn how to create your own system UDFs and make them available in all databases.
Read about standards for naming, formatting, and documenting UDFs.
The sample database in the downloadable files contains a ready-to-use library of over 100 functions and many additional functions that illustrate useful techniques.
The book is 454 pages and comes with a 150 example UDFs.