Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Drive Letter Finder Expand / Collapse
Author
Message
Posted Wednesday, November 11, 2009 7:24 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, October 30, 2014 9:38 AM
Points: 211, Visits: 57
Comments posted to this topic are about the item Drive Letter Finder
Post #817573
Posted Tuesday, November 17, 2009 4:33 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, November 14, 2014 9:55 AM
Points: 436, Visits: 2,311
I think this'll give you the same result with a lot less work:

declare @foo table (drive char(1),mbfree int)
INSERT INTO @foo EXEC master..xp_fixeddrives
IF @@rowcount = 26
SELECT '*' as drive
ELSE
SELECT TOP 1 drive FROM @foo ORDER BY drive

Or to see all the details:

declare @foo table (drive char(1),mbfree int)
INSERT INTO @foo EXEC master..xp_fixeddrives
SELECT * FROM @foo


Warning; xp_fixeddrives IS undocumented



Cursors are useful if you don't know SQL
Post #820482
Posted Wednesday, November 18, 2009 3:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:23 PM
Points: 5,734, Visits: 3,644
A small point - VERY SMALL - is that Available is spelt incorrectly. Thought you might want to correct the article.

Gaz

-- Stop your grinnin' and drop your linen...they're everywhere!!!
Post #820682
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse