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
⇒ "RETURNS TABLE" - Creating Inline Table-Value Functions in SQL Server
⇐ Categories of Functions Based on Return Modes in SQL Server
2016-12-18, 2954🔥, 0💬
Popular Posts:
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
How To Recover a Dropped Index in Oracle? If you have the recycle bin feature turned on, dropped ind...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
How to execute statements in loops in SQL Server Transact-SQL? How to use WHILE ... loops? You can u...
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...