Question

I am trying to create an assembly in SQL Server 2008 R2. I am using this below code to create the assembly.

CREATE ASSEMBLY [WRQ.Verastream.HostIntegrator] 
AUTHORIZATION [dbo]
FROM 'D;\.....\WRQ.Verastream.HostIntegrator.dll' 
WITH PERMISSION_SET = UNSAFE GO

But I am getting this error.

Msg 6586, Level 16, State 1, Line 1
Assembly 'WRQ.Verastream.HostIntegrator' could not be installed because existing policy would keep it from being used.

Was it helpful?

Solution

According to this article by Microsoft, Only members of the sysadmin fixed server role can create and alter UNSAFE assemblies. You will need to add your current login to the sysadmin fixed server role.

I don't have my management studio available at this time, but I believe this will work:

USE YOURDATABASENAME
GO

EXEC sp_addsrvrolemember 'YOURUSERNAME', 'sysadmin';

OTHER TIPS

Run the following command:

select * from sys.fn_my_permissions(NULL, 'SERVER')
where permission_name like '%ASSEMBLY%'

You're looking to see if you have either "external access assembly" or "unsafe assembly" (you'll likely need the latter). Also check to make sure that CLR is enabled at the server level with the following:

select value_in_use from sys.configurations where name = 'clr enabled'

If that doesn't return 1, CLR flat out won't run.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top