国产探花免费观看_亚洲丰满少妇自慰呻吟_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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 吉安县| 长海县| 北辰区| 浠水县| 河东区| 南通市| 石渠县| 岳西县| 富顺县| 井研县| 卢龙县| 桦南县| 清丰县| 东平县| 青海省| 娄烦县| 西吉县| 宝丰县| 阿巴嘎旗| 江山市| 仲巴县| 黄骅市| 微山县| 武穴市| 龙江县| 外汇| 邵东县| 嘉义市| 涡阳县| 武邑县| 安徽省| 临夏县| 兴城市| 麻城市| 卢龙县| 四川省| 石楼县| 漳浦县| 瑞金市| 青川县| 临朐县|