Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to convert numbers?

Author  Topic 

mqh7
Yak Posting Veteran

58 Posts

Posted - 2012-10-08 : 17:05:55
From the SCCM view called v_GS_LOGICAL_DISK I am retrieving the HD size and the available free disk space. How/where would I convert the returned numbers into a MB and/or GB format? I looked at the CONVERT function but it says "The CONVERT() function is a general function that converts an expression of one data type to another." and I want to keep it numbers....

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-10-08 : 17:33:06
Show us what it currently returns and what you want it to return, please.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

mqh7
Yak Posting Veteran

58 Posts

Posted - 2012-10-08 : 17:49:14
Here is an example of what it returns.

Computer Name Model Device ID Free Disk Space Actual Disk Size Description Primary Partition
84-pc-b67 HP Compaq 8200 Elite USDT PC C: 209763 228232 Local Fixed Disk 1

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-10-08 : 18:00:20
And what do you want it to return instead?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

mqh7
Yak Posting Veteran

58 Posts

Posted - 2012-10-08 : 18:20:25
Instead of a number I wanted it to say "Free Disk Space = 45GB" Vs just a number (for management you see!!)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-10-08 : 18:53:15
'Free Disk Space = ' + CONVERT(varchar(10), SomeColumn) + 'GB'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -