We Recommend

SQL Cookbook SQL Cookbook
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.


Posted By

DaveChild on 09/11/08


Tagged

freespace


Versions (?)


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.