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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Height/Weight conversion also BMI calculation

Author  Topic 

ALSZ37
Starting Member

25 Posts

Posted - 2014-10-07 : 17:23:20
Hi all,

I have been searching online, but have not found a easy way to do this. The application allows you to enter height by cm or ft and calculates it for you either way you enter it. For the weight same concept kg or lbs. The database stores the information in cm & kg and I have confirmed the application does the calculation along with the BMI.

I am looking for a way to convert cm to ft (eg. 5' 6") and kg to lbs. Is there a easy way of accomplishing this in a SQL query or SSRS expressions?

Thank you,
ALSZ37

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-10-07 : 18:06:49
Arithmetic... 1 kg = 2.2 lbs (Approximately...)
select MyWeight_kg / 2.2 as Pounds
from MyTable
Adjust the conversion factor if you need greater accuracy.



No amount of belief makes something a fact. -James Randi
Go to Top of Page

ALSZ37
Starting Member

25 Posts

Posted - 2014-10-07 : 18:40:42
quote:
Originally posted by Bustaz Kool

Arithmetic... 1 kg = 2.2 lbs (Approximately...)
select MyWeight_kg / 2.2 as Pounds
from MyTable
Adjust the conversion factor if you need greater accuracy.



No amount of belief makes something a fact. -James Randi



Thank you! Wouldn't it be multiplication? Adjust the conversion factor? How do I do this? The app shows 68kg is 149.9lbs. How did they get that?

68kg * 2.2 = 149.6599lbs

select myweight_kg * 2.2 from mytable
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-10-07 : 18:53:23
You are absolutely right. [red face]I had the conversion factor turned around... Oh, well, there goes perfection.......again.[/red face]



No amount of belief makes something a fact. -James Randi
Go to Top of Page

ALSZ37
Starting Member

25 Posts

Posted - 2014-10-07 : 22:22:52
quote:
Originally posted by Bustaz Kool

You are absolutely right. [red face]I had the conversion factor turned around... Oh, well, there goes perfection.......again.[/red face]



No amount of belief makes something a fact. -James Randi



LOL! No worries, thanks for giving me direction!
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-10-08 : 12:16:22
quote:
Adjust the conversion factor? How do I do this?
2.2 is approximately the conversion factor. You could use additional significant digits to yield a more precise result.



No amount of belief makes something a fact. -James Randi
Go to Top of Page
   

- Advertisement -