1

Closed

How to call into LukeSkywalker.IPNetwork from within TSQL

description

Hi,

Usin the below code I have registered the dll in SQL Server.

DECLARE @DLL as varchar(255)
SET @DLL = 'C:\Program Files (x86)\IPNetwork\bin\LukeSkywalker.IPNetwork.dll'
 
ALTER DATABASE CMS
SET TRUSTWORTHY ON
 
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
 
EXEC sp_configure 'clr enabled', 1
RECONFIGURE
 
CREATE ASSEMBLY IPNetwork FROM @DLL WITH PERMISSION_SET = UNSAFE
 
EXEC sp_configure 'show advanced options', 0

RECONFIGURE

After that I have tried to create a stored procedure linking to the external function.

This step corresponds to the "DECLARE Function" statement in VBA.

CREATE PROCEDURE spIPNetworkParse
     @IPAddress as varchar(15) 
    ,@netmask   as varchar(15)
AS

EXTERNAL NAME IPNetwork.[LukeSkywalker.IPNetwork.IPNetwork].Parse

However the above code returns the below error:
 
Msg 6572, Level 16, State 1, Procedure spIPNetworkParse, Line 1
More than one method, property or field was found with name 'Parse' in class 'LukeSkywalker.IPNetwork.IPNetwork' in assembly 'LukeSkywalker.IPNetwork'. Overloaded methods, properties or fields are not supported.
 
QUESTION:
Could you pls compile another version of this DLL, namely one making no use of overloaded methods? I know it's kind of code duplication but it would really help making this DLL accessible to a huge user-base.
Closed Apr 22, 2014 at 7:52 AM by LukeSkywalker

comments

pmurphy wrote Mar 16, 2012 at 5:22 PM

This is a bad idea as the SQL Server requires specific attributes to deal with the data layout, deterministic capacity of functions and many other elements that are not specified in the code.

wrote Feb 14, 2013 at 2:44 AM

LukeSkywalker wrote Apr 22, 2014 at 7:52 AM

TSQL integration is not supported yet. I'll gladly accept patch to make it work with TSQL.

wrote Apr 22, 2014 at 7:52 AM