Created
November 10, 2015 17:05
-
-
Save fcojperez/ef7be0e44fe99658b20b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE getFreeSpaceDrive | |
@drive varchar(1), | |
@MB_Free INT OUTPUT | |
AS | |
BEGIN | |
/* | |
* PROCEDURE FOR GETTING FREE SPACE IN A DRIVE @drive | |
* RETURN @MB_Free | |
* FOR TESTING PROCEDURE EXECUTE THESE LINES | |
* DECLARE @MB INT = 0; | |
* EXECUTE [getFreeSpaceDrive] | |
N'E', @MB_Free = @MB OUTPUT; | |
* PRINT CAST(@MB AS VARCHAR(10)); | |
*/ | |
SET NOCOUNT ON; | |
create table #FreeSpace (Drive char(1), MB_Free int); | |
insert into #FreeSpace exec xp_fixeddrives | |
SET @MB_Free = (select MB_Free | |
from #FreeSpace WHERE Drive = @drive); | |
DROP TABLE #FreeSpace; | |
SET NOCOUNT OFF; | |
RETURN; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment