Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Cannot CREATE ASSEMBLY

Author  Topic 

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2010-04-14 : 15:28:01
The assembly is not safe and

CREATE ASSEMBLY MyAssembly
FROM 'C:\MyPath\MyAssembly.dll'
WITH PERMISSION_SET = UNSAFE
GO

keeps on failing even though I am logged on as sa and the database is set to TRUSTWORTHY = ON.

The error message says that it order for an unsafe assembly to register, the DBO must have UNSAFE ASSEMBLY permissions (which should be implicit to the sa account) and the database must be set to TRUSTWORTHY. Both of these conditions are true yet the assembly still won't register.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-14 : 16:08:37
See if the fix mentioned in my blog post fixes it: http://weblogs.sqlteam.com/tarad/archive/2009/09/21/Fix-for-CLR-object-execution-error-after-attachrestore-in-SQL.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2010-04-14 : 21:48:08
Thanks! sp_changedbowner did the trick. This database had been backed up on one server and restored to another, which was where the problem was happening.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-15 : 13:25:44
Awesome! I thought it was a long shot since your error is different, glad that it worked for you.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -