massoud-1045248 (3/14/2011)
Thanks for the article but it seems that the link is not working.CreateAssemblyAndAggregate.sql
Also when I try to create the procedure below I get an error. I named the dll MedianSQLSERVER
Error Message:
Msg 6505, Level 16, State 1, Procedure Agg_Median, Line 1
Could not find Type 'Agg_Median' in assembly 'MedianSQLServer'.
CREATE PROCEDURE Agg_Median
AS
EXTERNAL NAME [MedianSqlServer].[Agg_Median].[Accumulate]
--Assembly.type.
Hello. The link should be fixed now, thanks to the editor, Steve Jones.
Also, you are using a 3-part name to point to the Aggregate, pointing specifically to the Accumulate method. You should not point to the method within the Aggregate, just to the Aggregate itself via a 2-part name. You are also missing the input parameter and the return type. And you call CREATE AGGREGATE instead of CREATE PROCEDURE. I assume it would be something like:
CREATE AGGREGATE [dbo].[Agg_Median] (@value [float])
RETURNS [float]
EXTERNAL NAME [MedianSqlServer].[Agg_Median]
Take care,
Solomon...
SQL# — https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
Sql Quantum Lift — https://SqlQuantumLift.com/ ( company )
Sql Quantum Leap — https://SqlQuantumLeap.com/ ( blog )
Info sites — Collations • Module Signing • SQLCLR