Scalar function examples Table-valued function examples Show 2 more Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW) This article describes how to create a user-defined function (UDF) in SQL Server by using Transact-SQL...
The return value can either be a scalar (single) value or a table. Use this statement to create a reusable routine that can be used in these ways: In Transact-SQL statements such as SELECT In applications that call the function In the definition of another user-defined function To ...
Scalar function examples Table-valued function examples Show 2 more Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW) This article describes how to create a user-defined function (UDF) in SQL Server by ...
The return value can either be a scalar (single) value or a table. Use this statement to create a reusable routine that can be used in these ways: In Transact-SQL statements such as SELECT In applications that call the function In the definition of another user-defined function To ...
] parameter_data_type [ NULL ] [ = default ] [ READONLY ] } [ , ...n ] ] ) RETURNS return_data_type [ WITH <function_option> [ , ...n ] ] [ AS ] BEGIN function_body RETURN scalar_expression END [ ; ] Transact-SQL 內嵌數據表值函式的語法。
Because the scalar function must be applied to every row, the resulting behavior is like row-based processing and degrades performance. Avoid the use of SELECT *. Instead, specify the required column names. This can prevent some Database Engine errors that stop procedure execution. For example,...
The return value can either be a scalar (single) value or a table. Use this statement to create a reusable routine that can be used in these ways: In Transact-SQL statements such as SELECT In applications that call the function In the definition of another user-defined function To ...
Transact-SQL 語法慣例 語法 --Transact-SQL Scalar Function Syntax CREATE FUNCTION [ schema_name. ] function_name ( [ { @parameter_name [ AS ][ type_schema_name. ] parameter_data_type [ = default ] [ READONLY ] } [ ,...n ]
This CREATE FUNCTION (SQL scalar) statement creates an SQL function at the current server. The function returns a single result. Invocation This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared. ...
A scalar function returns a single value each time it is invoked, and is generally valid wherever an SQL expression is valid. A table function can be used in a FROM clause and returns a table. A row function can be used as a transform function and returns a row. Invocation This statemen...