Click here to Skip to main content
15,885,244 members
Articles / Database Development
Tip/Trick

How-To Create a CLR Function with EffiProz Database

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
17 Mar 2010CPOL 11.5K   2   1
EffiProz(www.e...
EffiProz(www.effiproz.com) C# database is a light weight embedded database for .NET, ASP.NET, .NET CF & Silverlight applications. This article demonstrates how to create CLR functions with effiproz database.

Any static function can be use as the body of the CRL function (containing assembly should be already loaded). The sample demonstrate how-to create a simple CLR function to add two numbers.

First create the static c# function, like this:
public static int Add(int x, int y) { return x + y; }


Then create a SQL function that reference the static function createtd above,
CREATE FUNCTION add_num(x INT, y INT)
RETURNS INT
NO SQL
LANGUAGE DOTNET 
EXTERNAL NAME 'EffiProz.CLFunctionSample.Add'


Now we can call add_num function as any regular SQL function. e.g:
SELECT add_num(3,4) FROM DUAL;


You can download the sample code with upcoming Effiproz Database 0.1RC from http://www.effiproz.com/samples/CLRFunctionSample.zip

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralTable-Valued Functions Pin
dunscj16-Apr-11 3:10
dunscj16-Apr-11 3:10 
Any experience with getting TVFs to work? I'm getting the error user lacks privilege or object does not exist when I try to execute the function.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.