Using .NET Framework 3.5 in a SQL Server 2005 Stored Procedure

时光毁灭记忆、已成空白 提交于 2019-12-10 18:18:22

问题


I have an SQL Server 2005 server, and I'd like to run a .Net CLR stored procedure on it. However, I'd like to use .NET Framework 3.5.

If I try this right now, I get this error:

Error: Assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in the SQL catalog.

I'm told this is possible in SQL Server 2008, because SQL Server 2008 ships with .NET Framework 3.5. However, I'm wondering if there's a way to add .NET Framework 3.5 to my SQL Server 2005 installation, so that I can run .NET 3.5 stored procedures on it.


回答1:


This might be a stupid question but... If system.core can't be found, do you have the framework 3.5 installed on the database server?




回答2:


The result of google + trial & error

EXEC dbo.sp_changedbowner @loginame = N'sa', @map = true
GO
sp_configure 'clr enabled', 1
GO
RECONFIGURE
GO
ALTER DATABASE [MyDB] SET TRUSTWORTHY ON
GO
CREATE ASSEMBLY [System.Core]
AUTHORIZATION [dbo]
FROM 
'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll'
WITH PERMISSION_SET = UNSAFE
GO

Sites:

  • playing with sql server clr integration part iv deploying to sql server 2005
  • The-database-owner-SID-recorded-in-the-master-database-differs-from-the-database-owner-SID-recorded-in-database-DatabaseName



回答3:


This thread might be helpful to you.



来源:https://stackoverflow.com/questions/335524/using-net-framework-3-5-in-a-sql-server-2005-stored-procedure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!