all groups > sql server data warehouse > june 2006 >
You're in the

sql server data warehouse

group:

how to convert KB into MB



Re: how to convert KB into MB Roger Wolter[MSFT]
6/21/2006 2:04:07 PM
sql server data warehouse: I assume I'm missing something but have you tried

free_c/1024 AS Free

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

how to convert KB into MB Ricky
6/21/2006 8:13:04 PM
Hi

I need some help in how to convert a certain value in KB into MB. Please see
the bellow script where i put the question.

Thanks
[]
Ricky

select location+space(1)+'-'+space(1)+dept as 'Location',
compname as 'Computer Name',
ext_mem as 'Memory',
computermodel as 'Model',
drive_c as 'Capacity Drive C:', free_c as 'Free', -- how to obtain this
value in MB ?
drive_e as 'Capacity Drive E:', free_e as 'Free', -- how to obtain this
value in MB ?
--drive_c+space(1)+'-'+space(1)+free_c as 'Capacity Drive C:',
drive_e+space(1)+'-'+space(1)+free_e as 'Capacity Drive E:',
dos_ver+space(1)+operatingsystemversion+space(1)+operatingsystemservicepack
as 'Operating System',
cpu+space(1)+'CPU'+space(1)+cpu_speed+'GHZ' as 'Processor(s) Type',
cpusinstalled as 'Quantity',
tcpip as 'IP Address(es):'
from workstat
where dos_ver like '%windows 2003%' or dos_ver like '%windows 2000 -
server%'
or dos_ver like '%advanced%'
order by location, dept


Re: how to convert KB into MB Roger Wolter[MSFT]
6/22/2006 8:01:49 PM
CAST(ext_mem/1024 as varchar(10))+' MB' as 'Memory'

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

Re: how to convert KB into MB Ricky
6/23/2006 2:29:37 AM
Roger

Thanks for the tip but i'm getting the following errors now when i try to
concatenate the value with the string 'MB'.

I want to result like this: 4MB



select location+space(1)+'-'+space(1)+dept as 'Location',
compname as 'Computer Name',
--error in the line below
--Syntax error converting the varchar value 'MB' to a column of data type
int.
ext_mem/1024+'MB' as 'Memory',
computermodel as 'Model',
--error in the line below
--Error converting data type varchar to float.
drive_c/(1024)+'MB' as 'Capacity Drive C:', free_c as 'Free',
drive_e as 'Capacity Drive E:', free_e as 'Free',
drive_c+space(1)+'-'+space(1)+free_c as 'Capacity Drive C:',
drive_e+space(1)+'-'+space(1)+free_e as 'Capacity Drive E:',
--error in the line below
--Error converting data type varchar to float.
dos_ver+space(1)+operatingsystemversion+space(1)+operatingsystemservicepack
as 'Operating System',
cpu+space(1)+'CPU'+space(1)+cpu_speed+'GHZ' as 'Processor(s) Type',
cpusinstalled as 'Quantity',
tcpip as 'IP Address(es):'
from workstat
where dos_ver like '%windows 2003%' or dos_ver like '%windows 2000 -
server%'
or dos_ver like '%advanced%'
order by location, dept

Thanks
[]
Ricky


[quoted text, click to view]

Re: how to convert KB into MB Ricky
6/24/2006 5:47:21 PM
Hi

I did like this:
CAST(ext_mem/1024000 as varchar(12))+' MB' as 'Memory'

and thanks for the tips/help.
[]
Ricky


[quoted text, click to view]

AddThis Social Bookmark Button