Pages

Tuesday, December 11, 2018

MS SQL 2017 CLR with Oxygene


Integration of programmer's code with SQL perhaps is one of dilemmas for many years. You have tons of legacy specific code written in Delphi/Object Pascal and you are unable to port it all into Transact SQL - that is true. But .NET was developed in mind to let your code run everywhere. Microsoft did a great job allowing CLR to be a essential part of SQL.

Good news! Today Oxygene can be used to produce SQL CLR projects e.g. user defined functions, stored procedures etc…

Let us create create .NET assembly with a User Defined Function for MS SQL.




We will call our assembly SqlClrOxygene.dll.

And some basic global function in Oxygene that will return us hardcoded string.


Now we are ready to build our SqlClrOxygene.dll which is as tiny as 5kb in size. But to get use of it 
we must register the dll in MS-SQL2017 as Assembly. 
Go to Your Database->Programmability->Assemblies and add New Assembly.. in pop-up menu.



After that we should register new Scalar-valued Function in assembly with SQL engine.

Ready to Go?


Thank you RemObject guys who move us into .NET. Vivat! Vivat! Vivat!



No comments:

Post a Comment