Compartir a través de


Advantages of CLR User-Defined Aggregates

In earlier releases of Microsoft SQL Server, to compute an aggregate value over a group, you had to retrieve the values as a result set, and then enumerate over the result set using server- or client-side cursors. This made it necessary to write the code for both the iteration and the accumulation logic, which often resulted in slow and complicated code.

In SQL Server 2005, with the user-defined aggregate functions now made possible by the Microsoft .NET Framework, you only need to implement the code for the accumulation logic. The query processor manages the iteration, and any user-defined aggregates referenced by the query are automatically accumulated and returned with the query result set. This approach can be orders of magnitude faster than using cursors, and comparable to using SQL Server built-in aggregate functions.

Vea también

Otros recursos

CLR User-Defined Aggregates

Ayuda e información

Obtener ayuda sobre SQL Server 2005