Get Space on SQL hardrive

,

For all drives
 [KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE] --all for 100 mg
For a specific Drive with Specific size specified     
  [KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE] @MinMBFree =1000 , @Drive='C' --soecific drive 
if Exists (select 1 from sysobjects where name ='KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE')
begin
 DROP PROCEDURE [KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE]
end 
go
CREATE  PROCEDURE [dbo].[KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE]
@MinMBFree int= 100, @Drive char(1) = NULL
AS 
BEGIN 
/*
  CREATED BY Kraai Du Toit
  USE : [KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE] --all for 100 mg
        [KDT_SP_SYSTEM_HEALTH_DRIVE_SPACE] @MinMBFree =1000 , @Drive='C' --soecific drive 

  used with a robot control on a page .

  Comment: If a Astronaut eats a space cake, does he still space out.
  
  KraaiComedy.com
  Jfkproductions.co.za
  MCP :sql server 2008 r2
  MCTS:.net 
  MCTS: HTML5 CSS3 Javascript

*/

CREATE TABLE #tbl_xp_fixeddrives
(Drive varchar(2) NOT NULL,
[MB free] int NOT NULL)

-- 4 - Populate #tbl_xp_fixeddrives
INSERT INTO #tbl_xp_fixeddrives(Drive, [MB free])
EXEC master.sys.xp_fixeddrives

SELECT Drive,[MB free],CASE WHEN ([MB free] < @MinMBFree *2)   THEN 
  'AMBER' 
 WHEN [MB free]<= @MinMBFree THEN
 'RED' 
 ELSE
 'GREEN' 
 END  COLOR 
 
FROM #tbl_xp_fixeddrives
WHERE Drive = ISNULL(@Drive,Drive)

DROP TABLE #tbl_xp_fixeddrives

END

Rate

2.4 (5)

Share

Share

Rate

2.4 (5)