0

I want to create a custom aggregate function like SUM().

Can anyone help me how to create such an aggregate function in which we pass a column or row which returns a sum answer.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Adeel Ahmad
  • 11
  • 1
  • 3
  • I think you can just write a UDF, as you would any other custom function. But maybe tell us what you need to do; perhaps it can already be done with what SQL Server ships. – Tim Biegeleisen May 05 '18 at 14:33
  • I know it already exist in SQL server but i need to learn that how create a aggregate function and type parameters and returns type also – Adeel Ahmad May 05 '18 at 14:39
  • Possible duplicate of [this answer](https://stackoverflow.com/questions/4374709/custom-aggregate-function-concat-in-sql-server?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) – Peter Smith May 05 '18 at 16:30

1 Answers1

1

In SQL Server you can create CLR User-Defined Aggregates.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67