CREATE PROCEDURE sp_exec_getDiskSpace
(
@minGBfree int,
@Drive varchar(2)
)
AS
BEGIN
declare @MBfree int
select @MBfree=0
create table #tb_DiskSpace
([Drive] varchar(2),
[MBfree] int)
insert #tb_DiskSpace exec master.dbo.xp_fixeddrives
select @mbfree=[MBfree]
from #tb_DiskSpace
where [Drive]=@Drive
if @MBfree>@minGBfree*1024
return
else
begin
raiserror ('*** ERROR *** - 磁盤空間不足!', 16, 1)
end
drop table #tb_DiskSpace
END
只要赋予执行用户diskadmin权限以及该存储过程执行权限即可
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16754036/viewspace-711887/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16754036/viewspace-711887/