国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

利用SQL移動硬盤文件

2024-07-21 02:07:55
字體:
來源:轉載
供稿:網友


if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[p_movefile]') and objectproperty(id, n'isprocedure') = 1)
drop procedure [dbo].[p_movefile]
go

/*--移動服務器上的文件

 不借助 xp_cmdshell ,因為這個在大多數時候都被禁用了

--鄒建 2004.08(引用請保留此信息)--*/

/*--調用示例

 exec p_movefile 'd:/aa.txt','c:/'
--*/
create proc p_movefile
@s_file varchar(1000), --源文件
@d_file varchar(1000) --目標文件
as
declare @err int,@src varchar(255),@desc varchar(255)
declare @obj int

exec @err=sp_oacreate 'scripting.filesystemobject',@obj out
if @err<>0 goto lberr

exec @err=sp_oamethod @obj,'movefile',null,@s_file,@d_file
if @err<>0 goto lberr

exec @err=sp_oadestroy @obj
return

lberr:
 exec sp_oageterrorinfo 0,@src out,@desc out
 select cast(@err as varbinary(4)) as 錯誤號
  ,@src as 錯誤源,@desc as 錯誤描述
go
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁德市| 商水县| 阳城县| 萨嘎县| 宝应县| 陆良县| 开江县| 五大连池市| 双柏县| 新民市| 濮阳县| 金阳县| 昔阳县| 喜德县| 张家界市| 阿鲁科尔沁旗| 边坝县| 平乐县| 隆回县| 文成县| 桃园市| 大邑县| 乌什县| 延吉市| 南投市| 集贤县| 寿阳县| 垣曲县| 闵行区| 仙居县| 金山区| 桃园县| 礼泉县| 孟津县| 阿巴嘎旗| 富蕴县| 冷水江市| 克拉玛依市| 满洲里市| 马鞍山市| 延津县|