/build/static/layout/Breadcrumb_cap_w.png

Windows 7 Readiness Report

I have this report that works, but I'm trying to clean it up some. Basically trying to see what all machines cannot be upgraded to Win 7. My only problem is that I would like to display just the drive letter next to DISK_SIZE and DISK_FREE. I know I can add NAME, but it also gives info that I do not need. Does anyone know a better way to add just the drive letter to those fields?

SELECT M.NAME AS NAME,

OS_NAME,PROCESSORS,RAM_TOTAL,

GROUP_CONCAT(DISTINCT DISK_SIZE SEPARATOR '\n') AS 'DISK_SIZE(GB)',

GROUP_CONCAT(DISTINCT MD.DISK_FREE SEPARATOR '\n') AS 'DISK_FREE(GB)',

VIDEO_CONTROLLERS as VIDEO

FROM MACHINE M

LEFT JOIN MACHINE_DISKS MD

ON

(MD.ID = M.ID)

where OS_NAME NOT LIKE '%Mac%'

and OS_NAME not like '%Windows 7%' and OS_NAME not like '%ppc%' and OS_NAME not like '%server%' and OS_NAME not like '%linux%'

and OS_NAME not like '%x86%' and OS_NAME not like '%cent%'

and cs_model not like 'VM%' and cs_model not like 'Virtual%'

AND

(1  not in

(

select 1 from MACHINE_DISKS where MD.ID = M.ID

and

if(M.OS_ARCH like '%x86%',MD.DISK_FREE >= '16',MD.DISK_FREE >= '20')

)

OR (RAM_TOTAL < '1024' OR RAM_TOTAL < '2048')

OR (M.PROCESSORS LIKE '%Mhz%'))

group by M.NAME

0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
SUBSTRING_INDEX(SUBSTRING_INDEX(MD.NAME, ' ', 2), ' ', -1) AS 'DRIVE_LETTER'
Posted by: jverbosk 11 years ago
Red Belt
1

Try this - it uses MACHINE_DISKS.NAME, but will only return the letter (i.e. C:):

SUBSTRING_INDEX(SUBSTRING_INDEX(MD.NAME, ' ', 2), ' ', -1) AS 'DRIVE_LETTER'

John


Comments:
  • That works... Some of these machines have 4-6 drives. Determining which one is the main narrows it down. Thanks John. - dugullett 11 years ago
Posted by: SMal.tmcc 11 years ago
Red Belt
0

Comments:
  • or this
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa394592(v=vs.85).aspx - SMal.tmcc 11 years ago
  • That's for vbscript. This is a SQL query. - dugullett 11 years ago
  • oops pulled a Homer - SMal.tmcc 11 years ago
    • at least now I can say the drugs are legal - SMal.tmcc 11 years ago
  • do not know much on sql language, but will look for links as my images do there stuff
    yea or nay?
    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=158859 - SMal.tmcc 11 years ago
  • http://www.sqlservercentral.com/Forums/Topic440435-5-1.aspx
    end of day, Off to check out Hot August Nights Car show. good luck - SMal.tmcc 11 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ