Reputation: 3675
I'm trying to integrate a DLL into my SQL Server 2012 database, following the example from here.
The command is:
CREATE ASSEMBLY Excel_Procs_IF
FROM 'd:\MyDir\UWQ_Excel_Compute.dll'
WITH PERMISSION_SET = SAFE ;
and I get the following error message:
Msg 6215, Level 16, State 1, Line 1
CREATE ASSEMBLY failed because method 'get__Default' on type 'Microsoft.Office.Interop.Excel.Range' in safe assembly 'UWQ_Excel_Compute' has invalid attribute 0x1083.
I have no idea what this means nor how to tackle the issue.
Upvotes: 2
Views: 229
Reputation: 48826
You need to change the PERMISSION_SET
in your CREATE ASSEMBLY
statement to be UNSAFE
. Then it should work.
As stated on the MSDN documentation page for Office Primary Interop Assemblies:
To use the features of a Microsoft Office application from an Office project, you must use the primary interop assembly (PIA) for the application. The PIA enables managed code to interact with a Microsoft Office application's COM-based object model.
And, the page for Primary Interop Assemblies states:
A primary interop assembly is a unique, vendor-supplied assembly that contains type definitions (as metadata) of types implemented with COM.
COM is unmanaged code, and that requires the UNSAFE
Permission Set.
Upvotes: 4