CLR 使用者定義函數CLR User-Defined Functions

適用於: 是SQL Server 否Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

使用者定義函數是可以使用參數、執行計算或其他動作,並傳回結果的常式。User-defined functions are routines that can take parameters, perform calculations or other actions, and return a result. SQL Server 2005 (9.x)SQL Server 2005 (9.x) 開始,您可以使用任何 MicrosoftMicrosoft .NET Framework 程式設計語言 (例如,MicrosoftMicrosoft Visual Basic .NET 或 MicrosoftMicrosoft Visual C#) 撰寫使用者定義函數。Beginning with SQL Server 2005 (9.x)SQL Server 2005 (9.x), you can write user-defined functions in any MicrosoftMicrosoft .NET Framework programming language, such as MicrosoftMicrosoft Visual Basic .NET or MicrosoftMicrosoft Visual C#.

函數有兩種類型:傳回單一值的純量值函式,以及傳回一組資料列的資料表值函式。There are two types of functions: scalar, which returns a single value, and table-valued, which returns a set of rows.

下表列出本節的主題。The following table lists the topics in this section.

CLR 純量值函式CLR Scalar-Valued Functions
涵蓋純量值函式的實作需求與範例。Covers implementation requirements and examples of scalar-valued functions.

CLR 資料表值函式CLR Table-Valued Functions
討論如何實作與使用資料表值函式 (TVF),以及 Transact-SQLTransact-SQL 和 Common Language Runtime (CLR) TVF 之間的差異。Discusses how to implement and use table-valued functions (TVFs), as well as differences between Transact-SQLTransact-SQL and common language runtime (CLR) TVFs.

CLR 使用者定義彙總CLR User-Defined Aggregates
描述如何實作及使用使用者定義彙總。Describes how to implement and use user-defined aggregates.

另請參閱See Also

使用者定義的函式User-Defined Functions