exec master..xp_cmdshell'net use z: //IP/盘符$/站点文件/子文件夹 "登录密码" /user:IP/用户名'
declare @kh_id varchar(20)
declare @return int
declare @filepath varchar(500)
declare @files varchar(200)
declare @sql varchar(500)
set @files='z:/'
set @return =0
declare mycur cursor for
select a.kh_id FROM client as a
open mycur
fetch next from mycur into @kh_id
while @@fetch_status=0
begin
set @filepath=@files+cast(@kh_id as varchar(20))+'.xml'
exec xp_fileexist @filepath,@return out
if (@return =1)
begin
set @sql= 'del '+@filepath
exec master..xp_cmdshell @sql
end
fetch next from mycur into @kh_id
end
close mycur
deallocate mycur
exec master..xp_cmdshell 'net use z: /delete'
存储过程删除局域网文件
最新推荐文章于 2024-07-09 20:53:52 发布