CREATE AGGREGATE

Create a user-defined aggregate function. Binding the function will require CREATE ASSEMBLY.

Syntax
      CREATE AGGREGATE [ schema_name . ] aggregate_function_name
          (@param_name <input_sqltype> )
      RETURNS <return_sqltype>
      EXTERNAL NAME assembly_name [ .class_name ]

      <input_sqltype> ::=
              system_scalar_type | { [ udt_schema_name. ] udt_type_name }

      <return_sqltype> ::=
              system_scalar_type | { [ udt_schema_name. ] udt_type_name }

Key
   @param_name         A parameter in the user-defined aggregate (@ as the first character)
                       value supplied by the user when the function is executed.
				  
   system_scalar_type  Any SQL Server system scalar data type
				  
   udt_schema_name     Schema to which the CLR user-defined type belongs, default=current user schema
   
   udt_type_name       CLR user-defined type already created in the current database. 
	
   assembly_name [ .class_name ] 
                       Assembly to bind with the user-defined aggregate function and,
                       optionally, the name of the schema to which the assembly belongs
                       and the assembly class that implements the user-defined aggregate
	                      default class_name=same as aggregate_name.

Examples

  CREATE AGGREGATE myFunction(@input varchar(500))
  RETURNS varchar(500)
  EXTERNAL NAME [myAssembly].[ss64.StringUtils.myFunction];
  GO

"The world is moved along not only by the mighty shoves of its heroes, but also by the aggregate of the tiny pushes of each honest worker" ~ Helen Keller

Related commands:

DROP AGGREGATE
CREATE ASSEMBLY

Equivalent Oracle command:

CREATE FUNCTION


© Copyright SS64.com 1999-2014
Some rights reserved