troubleshooting Question

Modify SQL query to get additional Column

Avatar of MOQINFRA
MOQINFRA asked on
Microsoft SQL Server 2008
1 Comment1 Solution299 ViewsLast Modified:
We have a SQL query to fetch the Space Information on the disks from one of our views in the SCCM databases. This database has columns like disk_Size, Free_Space etc, however we dont have a column for Used Space in that view

there is colum fro FreeSpace and Size
I want to Create a SQL query with a Colum UsedSpace = Size - Free space

the Query is mentioned below that gives me Size and Free Space

Any help to modify this query  to fetch that detail

the Original Query providing FreeSpace and Size is given below.


SELECT Distinct SYS.Name,LDISK.DeviceID0, LDISK.Description0, LDISK.VolumeName0,
 LDISK.FreeSpace0 as [Free space (MB)],
 LDISK.FreeSpace0/1024 as [Free space (GB)],
 LDISK.Size0/1024 as [Total space (GB)],

 FROM v_FullCollectionMembership SYS
 join v_GS_LOGICAL_DISK LDISK on SYS.ResourceID = LDISK.ResourceID
 JOIN v_R_System RSYS ON SYS.ResourceID = RSYS.ResourceID
ASKER CERTIFIED SOLUTION
Kyle Abrahams
Director of Information Technology

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros