Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculation within a select satement

Status
Not open for further replies.

MrDontKnowNothing

Programmer
Jun 26, 2003
94
DE
hi folks,

i'd like to do some calculations within a query, but the result is only a integer value but i need something like a float.

select (value / 100 + value) as newvalue from mytable

any help appriciated...thanx!

alex
 
Cast the value as float to get a result in float

Here:
select ( cast( value as float) / 100 + value) as newvalue from mytable


Bobby
 
Try:

Code:
SELECT value / 100.0 + value AS newvalue
FROM mytable

--James
 
What do you mean by "how to provide a usefull prevision?"

-SQLBill
 
sorry, i meant "precision".
in other words: how to make it look like "3131,85"

cheers

alex
 
Code:
SELECT cast(value / 100.0 + value as decimal(6,2)) AS newvalue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top