• copling (9/10/2014)


    Mr. Solomon, I really enjoyed your article in regards to External and Unsafe security framework for SQLCLR. I've really been interested in utilizing the power that this piece of technology possess. I do however, one question: Is it possible for a SQLCLR to be built with an external dll? For example, let's say I have a dll that receives data and creates an excel file. Can I reference that dll from within my SQLCLR and pass in the necessary parameters to it's methods and to build that file? I would assume if so, the security for your SQLCLR would have to run under EXTERNAL or UNSAFE. Again, thanks for the great article.

    Hi there. Thanks and I am glad that you liked the article :-).

    Regarding the external DLL, I have not tried that specifically. I believe you will need to load it into SQL Server with a PERMISSION_SET of UNSAFE (but you should try EXTERNAL_ACCESS first, just in case it works). In your project, you would add the reference and "using" statement. That DLL will be able to save the Excel file to the file system.

    If you are going to do the preferred method of the Asymmetric Key and Login in order to be able to set the 3rd party Assembly to UNSAFE (or even EXTERNAL_ACCESS), you will need to sign it with the same private key (i.e. pfx file) that are using to sign the Assembly that has the SqlProcedure.

    Take care,

    Solomon...

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR