如何开启SQL CLR

 如何开启SQL CLR
 
开启SQL CLR有两步操作,如下所示:
1.       开启SQLCLR,在sql server2005中执行如下脚本,开启SQL CLR功能

EXEC sp_configure 'show advanced options' , '1';

go

reconfigure;

go

EXEC sp_configure 'clr enabled' , '1'

go

reconfigure;

-- Turn advanced options back off

EXEC sp_configure 'show advanced options' , '0';

go

ALTER DATABASE test SET TRUSTWORTHY ON

reconfigure

go

2.        注册程序集,因为使用C#实现SQL功能,有些DLL文件没有被SQL SERVER安装,所以要手动注册,在在sql server2005中执行如下脚本

CREATE ASSEMBLY

SMDiagnostics from

'C:WindowsMicrosoft.NETFrameworkv3.0Windows communication FoundationSMDiagnostics.dll'

with permission_set = UNSAFE

 

GO

 

CREATE ASSEMBLY

[System.Web] from

'C:WindowsMicrosoft.NETFrameworkv2.0.50727System.Web.dll'

with permission_set = UNSAFE

 

GO

 

CREATE ASSEMBLY

[System.Messaging] from

'C:WindowsMicrosoft.NETFrameworkv2.0.50727System.Messaging.dll'

with permission_set = UNSAFE

 

GO

 

CREATE ASSEMBLY 

[System.IdentityModel] from

'C:Program FilesReference AssembliesMicrosoftFrameworkv3.0System.IdentityModel.dll'

with permission_set = UNSAFE

 

GO

 

CREATE ASSEMBLY 

[System.IdentityModel.Selectors] from

'C:Program FilesReference AssembliesMicrosoftFrameworkv3.0System.IdentityModel.Selectors.dll'

with permission_set = UNSAFE

 

GO

 

CREATE ASSEMBLY -- this will add service modal

 

[Microsoft.Transactions.Bridge] from

'C:WindowsMicrosoft.NETFrameworkv3.0Windows Communication FoundationMicrosoft.Transactions.Bridge.dll'

with permission_set = UNSAFE

 

GO

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值