I am trying to be able to run a .Net dll through SQL using the CLR - I am doing so unsuccessfully.
I am following the instructions here
So I am doing the following:
CREATE ASYMMETRIC KEY AKEY_SqlClr FROM EXECUTABLE FILE = 'C:\dlls\mySqlClr.dll'
Which works fine and creates the Key, then I try to do the following:
CREATE LOGIN SQLCLR_AsymKeyLogin FROM ASYMMETRIC KEY AKEY_SqlClr
And I get the error:
Cannot find the asymmetric key 'AKEY_SqlClr', because it does not exist or you do not have permission.
How could I not have permissions to this? I have verified that I have CREATE LOGIN permissions. Any ideas?
Logins are server principals and as such they cannot be created from keys stored in user databases. You must create the key from assembly in master
database:
use master;
CREATE ASYMMETRIC KEY AKEY_SqlClr FROM EXECUTABLE FILE = 'C:\dlls\mySqlClr.dll';
CREATE LOGIN SQLCLR_AsymKeyLogin FROM ASYMMETRIC KEY AKEY_SqlClr;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With