Functions That Return a Table

There are two types of tabular functions. If the RETURNS statement contains the TABLE data type with all the columns that are contained in the table defined, the function is known as a multi-statement tabular function. If the RETURNS section of the function contains the TABLE data type with no columns listed, the function is known as an in-line function. In-line functions are table-valued functions that contain a SELECT statement as the body of the function. The returned columns and data types are derived from the SELECT statement.

Multi-Statement Tabular Functions

Multi-statement tabular functions are a powerful alternative to views. Like a view, this type of function can be used in a T-SQL statement in the same ...

Get Writing Stored Procedures for Microsoft SQL Server 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.