首页 > 数据库技术 > 详细

sql server 调用 fso

时间:2021-05-10 19:54:21      阅读:26      评论:0      收藏:0      [点我收藏+]
DECLARE @hr INT , 
    @fso INT, 
    @drive CHAR(1)=‘F‘,  /* To demonstrate have hard coded the drive letter to F */
    @odrive INT,
    @TotalSize BIGINT,
    @freespace BIGINT,
    @AvailableSpace   BIGINT,
    @DriveCollection INT,
    @DriveCount INT,
    @FileSystemInstance  INT,
    @volumeName varchar(128),
    @IsReady VARCHAR(5)
  EXEC sp_OACreate ‘Scripting.FileSystemObject‘,@fso OUT
  EXEC sp_OAMethod @fso,‘GetDrive‘, @odrive OUT, @drive 
  EXEC sp_OAGetProperty @odrive,‘TotalSize‘, @TotalSize OUT
  EXEC sp_OAGetProperty @odrive,‘freespace‘, @freespace OUT
  EXEC sp_OAGetProperty @odrive,‘AvailableSpace‘, @AvailableSpace OUT
  EXEC sp_OAGetProperty @fso,‘Drives‘, @DriveCollection OUT
  EXEC sp_OAGetProperty @DriveCollection,‘Count‘, @DriveCount OUT
  EXEC sp_OAGetProperty @odrive,‘VolumeName‘, @volumeName OUT
  EXEC sp_OAGetProperty @odrive,‘isReady‘, @IsReady OUT

  SELECT
  @DriveCount driveCount
  ,@Drive DriveLetter,
  (@AvailableSpace/1048576)/1024 FreeSpace,
  @volumeName Volumne,
  @IsReady DriveStatus,
  (@TotalSize/1048576)/1024.00 TotalSize,
  (@freespace/1048576)/1024.00 FreeSpace

 

sql server 调用 fso

原文:https://www.cnblogs.com/nanfei/p/14751364.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!