zoukankan      html  css  js  c++  java
  • sql server 调用 fso

    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
    桂棹兮兰桨,击空明兮溯流光。
  • 相关阅读:
    【redis】--安全
    【redis】-- 数据备份和恢复
    2018.2.8 cf
    寒假零碎的东西 不定时更新补充.......
    hdu 1018
    2018寒假acm训练计划
    UVAlive 7466
    母函数
    简单数学题(水的不能在水的题了)
    随便写写的搜索
  • 原文地址:https://www.cnblogs.com/nanfei/p/14751364.html
Copyright © 2011-2022 走看看