Hello,
I am trying to send to colums to SQL CLR function and get some results. I want the CLR code be like:
Code Snippet
public void DoSomething(SqlDouble[] a, SqlDouble[] b, out SqlDouble x, out SqlDouble y, out SqlDouble z)
{
//Do Something...
x = ....
y=...
z=...
}
I want to call this code from SQL code:
Code Snippet
create table #Temp (float a,float b)
declare @.x float
declare @.y float
declare @.z float
exec dbo.DoSomething(a,b,@.x,@.y,@.z) ?
Do someone have an idea?
Hi Shlomi,
There are many tutorials for achieving this on the net and even in BOL. Look for "CLR User-Defined Functions" Books Online for examples.
In short: If you're using Visual Studio, you open the right project and choose Add Function. Sceleton code is presented and you add your code. Now build the Assembly. After building, go to SQL Server and user CREATE ASSEMBY to import the assembly into SQL Server and last use CREATE FUNCTION to import the function from the assembly. Now you can use your function in SQL Server like you want to.
No comments:
Post a Comment