Easy SQL question 
Author Message
 Easy SQL question
SQL:

SELECT l.minute, l.minute/60 as MinDiv60 FROM lo_lat_long l

MinDiv60 always returns zero! I have tried a CONVERT function with no luck.
The "Minute" field is type tinyint. I would like to return a decimal value.
Thanks!



Sat, 29 May 2004 05:52:34 GMT
 Easy SQL question

[posted and mailed, please reply in news]

Quote:

> SELECT l.minute, l.minute/60 as MinDiv60 FROM lo_lat_long l

> MinDiv60 always returns zero! I have tried a CONVERT function with no
> luck. The "Minute" field is type tinyint. I would like to return a
> decimal value.

Like in several other languages, the function of "/" depends on the involved
data types. If you have only have integer values you get integer division.
The trick in this is

   SELECT l.minute, l.minute/60.0 as MinDiv60 FROM lo_lat_long l

Fortran legacy...

--
Erland Sommarskog, Abaris AB

SQL Server MVP



Sat, 29 May 2004 07:28:06 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Easy SQL Question

2. Easy SQL question

3. Easy SQL question - query within query?

4. Easy SQL Question

5. Easy SQL Question!!

6. easy SQL question

7. Hopefully an easy SQL question

8. Easy SQL Question

9. Easy SQL Question!!

10. An easy SQL question

11. EASY SQL question!

12. Newbie Easy SQL Question


 
Powered by phpBB® Forum Software