Create CLR(Command Language Runtime) procedure and Deployment

本文探讨了在T-SQL脚本中检查文件是否存在的一种替代方法:避免使用xp_fileexist,并介绍了通过CLR创建自定义函数部署到数据库服务器的具体步骤。

Need to check file existence in T-SQL scripts.

DBA suggested not using xp_fileExist , example as below :

declare @FileOK  INT

exec xp_fileExist 'D:\TmsCallUpdate\TmsCallUpdate.csv',@FileOK OUTPUT

Print @FileOK

if @FileOK=1
BEGIN

....

END

 

Then turn to CLR, to use CLR create a function and delpoy to Database Server :

Use VS 2010, create a SQL server 2005 project , add a function ,then build and deploy to DB server.  The function or procedure will be under "Store Procedures" or "Functions" as normal ones.

Reference :

http://carlosbercero.com/post/?post=How_to_create_an_SQL_CLR_Project_in_Visual_Studio_2008

http://carlosbercero.com/post/?post=Writing_a_CLR_Stored_Procedure_on_SQL_Server

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值