I have developed a small DLL containing a single function as shown below:
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop
Public Class UWQ_IF_to_Excel
Public Function Excel_Calculate(ByVal p_File_Reference, ByVal p_Sheet_Reference, ByVal p_In_Cells_Values, ByVal p_Result_Cell, ByRef p_Result, ByRef p_Result_Code)
<body>
Return 0
End Function
End Class
Out DBA loaded it with the name xsp_excel
.
From the documentation I learned that I need to create a function referencing the assembly, but I keep getting syntax errors even though I'm following the instructions in here.
Could anyone post the right way of doing it?
(NOTE: I'm aware that SQL SERVER does not allow OUT parameters in function (in contrast to other DBMSs), but at this point I want to reach the point in which the function is invoked; once this is working, will change the DLL to return a table like in the example of the link above).
Edit
Based on the example provided gotqn (see comment below), I'm trying this:
CREATE PROCEDURE [UWQ].[p_FUND_Calculate_With_Excel] ( @_l_Excel_File NVARCHAR(512) ,
@_l_Excel_Sheet NVARCHAR( 64) ,
@_l_Excel_String_to_Send NVARCHAR(999) ,
@_l_Excel_Result_Cell NVARCHAR( 16) ,
@_l_Result FLOAT OUTPUT ,
@_l_Result_Code INT OUTPUT )
AS EXTERNAL NAME [dbo].[xsp_excel].[UWQ_IF_to_Excel].[Excel_Calculate] ;
As far as I can see, the syntax appears to be correct (obviously I'm missing something though). Still, I'm getting the error:
Msg 102, Level 15, State 1, Procedure p_FUND_Calculate_With_Excel, Line 8 Incorrect syntax near '.'.
When double-clicking at the error, the cursor is moved to the line AS EXTERNAL NAME [dbo].[xsp_excel].[UWQ_IF_to_Excel].[Excel_Calculate] ;
.
Can anyone tell me what the error is?