开发者

Cannot find the asymmetric key -- because it does not exist or you do not have permission

开发者 https://www.devze.com 2023-04-06 17:08 出处:网络
I am trying to be able to run a .Net dll through SQL using the CLR - I a开发者_运维百科m doing so unsuccessfully.

I am trying to be able to run a .Net dll through SQL using the CLR - I a开发者_运维百科m 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;
0

精彩评论

暂无评论...
验证码 换一张
取 消