Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 617
Pandincus Avatar asked Apr 07 '26 16:04

Pandincus


2 Answers

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?

like image 93
James Orr Avatar answered Apr 09 '26 07:04

James Orr


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
like image 36
Scott Weinstein Avatar answered Apr 09 '26 05:04

Scott Weinstein