Question

Has anyone successfully used MathNet.Numerics as a CLR assembly in SQL Server?

Using SQL Server 2012 on Windows 8, I've managed to do a CREATE ASSEMBLY pointing at the DLL but when I try to do

CREATE TYPE Normal EXTERNAL NAME MathNetNumerics.[MathNet.Numerics.Distributions.Normal]

I get an error message:

"does not conform to the UDT specification: missing custom attribute Microsoft.SqlServer.Server.SqlUserDefinedTYpeAttribute".

Was it helpful?

Solution

It seems that you cannot use arbitrary .Net code in SQL CLR but have to develop specifically for it, by decorating your code with attributes like SqlFunction and using its own special types like SqlDouble instead of just System.Double.

Nevertheless, I'd expect you can write a small wrapper/adapter .Net library and then reference and call Math.NET Numerics routines from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top