Collections:
Syntaxes of Creating Table-Valued Functions in SQL Server
How Many Ways to Create Table-Valued Functions in SQL Server Transact-SQL?
✍: FYIcenter.com
SQL Server supports two syntaxes of creating table-valued functions:
1. Inline Table-valued Functions - A table-valued function created with a single SELECT statement:
CREATE FUNCTION function_name( @parameter_1 data_type, @parameter_2 data_type, ... @parameter_n data_type ) RETURNS TABLE AS RETURN (select_statement);
2. Multi-statement Table-valued Functions - A table-valued function created with a local temporary table and a statement block:
CREATE FUNCTION function_name( @parameter_1 data_type, @parameter_2 data_type, ... @parameter_n data_type ) RETURNS @table_variable_name TABLE ( column_definition_list) AS BEGIN statement_1; statement_2; ... statement_n; RETURN END
2016-12-18, 469👍, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Downloading and Installing SQL Server 2005 Ex...
How To Select Some Specific Columns from a Table in a Query in SQL Server? If you want explicitly te...
How Fixed Length Strings Are Truncated and Padded in SQL Server Transact-SQL? When the length of the...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...