| Author |
Topic |
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-07-16 : 06:49:27
|
| hi friends,select [Geo Code], [Bell Rating],[Boatyard Rating], Sunset from rpm_Acc where MarinaNo = 2780This is my code .Its displays the values as[Geo Code], [Bell Rating],[Boatyard Rating], Sunset40.099998 1 1 0but i need to the display the values as40 1 1 0I need query to display the above result. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-16 : 06:50:48
|
| use ROUND([Geo Code],0) |
 |
|
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-07-16 : 06:57:51
|
| i tried but i never get. when i use select floor(40.12). i m getting the result 40. But i not able to get the result when i use this query " select floor([Geo Code]), [Bell Rating],[Boatyard Rating], Sunset from rpm_Acc where MarinaNo = 2780" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-16 : 07:26:00
|
| What is the datatype of [Geo Code]?MadhivananFailing to plan is Planning to fail |
 |
|
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-07-16 : 07:38:46
|
| real datatype |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-16 : 08:03:12
|
quote: Originally posted by vidhya real datatype
can we see the query used by you?it should work for real data. |
 |
|
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-07-16 : 08:22:03
|
| select round([Geo Code],0), [Bell Rating],[Boatyard Rating], Sunset from rpm_Acc where MarinaNo = 2780 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-16 : 08:28:28
|
| try this too:-cast([Geo Code] as int) |
 |
|
|
vidhya
Posting Yak Master
108 Posts |
Posted - 2008-07-16 : 08:40:10
|
| thanks a lot its working fine. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-07-16 : 08:42:37
|
| Depending on how you want to round values, and how the cast handles this, you may want to add or subtract .5 from your value when casting.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-16 : 08:42:57
|
| note... casting it as an INT is not the same as the round() function. 40.9 would come out as 40 rather than 41. is that really what you want?Em |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-07-16 : 09:40:25
|
quote: note... casting it as an INT is not the same as the round() function. 40.9 would come out as 40 rather than 41. is that really what you want?
That's what I was referring to in my post ... The OP should review and test the rounding of the cast and compare that to what he or she wants, and then make an adjustment on the value when casting if necessary.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
|