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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing real to integer

Status
Not open for further replies.

neilmurray

Technical User
Jan 18, 2005
32
GB
Hi,

How do you change a variable that is a real number say $real=4.76 to an interger.
i.e change the variable to 4.

Thanks,

Neil.
 
but let me tell you this..

if your fractional part is greater than 0.5 then it will round up less it will round down...

Round(yourvar)=5 in your case since yourvar=4.76


-DNG
 
To round down, you can use the FLOOR function:
[tt]
SELECT FLOOR(realfield)
FROM ...
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top