Dogodek
31. mar., 23h - 2. apr., 23h
Največji dogodek učenja SQL, Fabric in Power BI. 31. marec - 2. april Če želite shraniti 400 $, uporabite kodo FABINSIDER.
Registrirajte se danesTa brskalnik ni več podprt.
Izvedite nadgradnjo na Microsoft Edge, če želite izkoristiti vse prednosti najnovejših funkcij, varnostnih posodobitev in tehnične podpore.
Applies to:
SQL Server 2016 (13.x) and later versions
You can create a database object inside SQL Server that is programmed in a CLR assembly. Database objects that can use the rich programming model provided by the CLR include triggers, stored procedures, functions, aggregate functions, and types.
Like the built-in aggregate functions provided in Transact-SQL, user-defined aggregate functions perform a calculation on a set of values and return a single value.
Creating a user-defined aggregate function in SQL Server involves the following steps:
Define the user-defined aggregate function as a class in a Microsoft .NET Framework-supported language. For more information about how to program user-defined aggregates in the CLR, see CLR user-defined aggregates. Compile this class to build a CLR assembly using the appropriate language compiler.
Register the assembly in SQL Server using the CREATE ASSEMBLY
statement. For more information about assemblies in SQL Server, see Assemblies (Database Engine).
Create the user-defined aggregate that references the registered assembly using the CREATE AGGREGATE
statement.
Executing CLR code is off by default in SQL Server. You can create, alter, and drop database objects that reference managed code modules, but these references don't execute in SQL Server, unless the clr enabled server configuration option is enabled by using sp_configure.
Deploying a SQL Server Project in Microsoft Visual Studio registers an assembly in the database that was specified for the project. Deploying the project also creates CLR functions in the database for all methods annotated with the SqlFunction
attribute. For more information, see Deploy CLR database objects.
Dogodek
31. mar., 23h - 2. apr., 23h
Največji dogodek učenja SQL, Fabric in Power BI. 31. marec - 2. april Če želite shraniti 400 $, uporabite kodo FABINSIDER.
Registrirajte se danesUsposabljanje
Modul
Create stored procedures and user-defined functions - Training
This content is a part of Create stored procedures and user-defined functions.
Dokumentacija
Create User-defined Functions (Database Engine) - SQL Server
Create User-defined Functions (Database Engine)
View User-defined Functions - SQL Server
View User-defined Functions
Deterministic and Nondeterministic Functions - SQL Server
Deterministic and Nondeterministic Functions