Posted By

DaveChild on 09/11/08


Tagged

freespace


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

nublaii
rhainek


SQL Write Disk Space to Table


 / Published in: SQL
 

This will run a bat file to get free space on a drive and write the results to a table.

Use script at http://snipplr.com/view/8331/calculate-free-space-on-drive/ as FreeSpace.bat

  1. IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'FreeSpace') DROP TABLE FreeSpace
  2.  
  3. CREATE TABLE FreeSpace ( SpaceInMB varchar(100) NULL )
  4.  
  5. INSERT INTO FreeSpace EXEC master..xp_CMDShell 'C:\Scripts\FreeSpace.bat'

Report this snippet  

You need to login to post a comment.