| Author |
Topic |
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2008-02-21 : 22:11:07
|
| Hi!I have money value of 56.0000.I want it to only give me the last two decimal places,56.00.I used this one to come up to that result:cast(round(sum(total),2)as int)but my result is this 56.Am i on the right track?Funnyfrog |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-02-21 : 22:16:31
|
| Tried cast(round(sum(total),2)as decimal(18,2))? |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2008-02-21 : 22:17:26
|
| i haven't tried it..i will try it now..thanks!Funnyfrog |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2008-02-21 : 22:19:06
|
| i tried it but it didn't work..Funnyfrog |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-02-21 : 22:37:57
|
| How about cast(sum(total) as decimal(18, 2))? |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2008-02-21 : 22:52:49
|
| i also tried that earlier,but still nothing happens.Funnyfrog |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-02-21 : 22:54:46
|
| Worked on my try. |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2008-02-21 : 22:56:38
|
| the datatype of my value is money..what could be the possible reason why it did't work in my try?Funnyfrog |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-02-21 : 23:02:01
|
| That's what I tested for. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-22 : 00:58:42
|
quote: Originally posted by shemayb the datatype of my value is money..what could be the possible reason why it did't work in my try?Funnyfrog
Run this and see what you getdeclare @m moneyset @m=56select @mselect cast(@m as decimal(12,2))MadhivananFailing to plan is Planning to fail |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2008-02-22 : 01:55:14
|
| it still won't work..Funnyfrog |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-22 : 03:25:07
|
quote: Originally posted by shemayb it still won't work..Funnyfrog
Post the query you usedMadhivananFailing to plan is Planning to fail |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-02-22 : 13:32:16
|
This maybe?DECLARE @Foo MONEYSET @Foo = $1231222.9897SELECT CONVERT(VARCHAR(20), @Foo, 1) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-23 : 00:56:05
|
quote: Originally posted by Lamprey This maybe?DECLARE @Foo MONEYSET @Foo = $1231222.9897SELECT CONVERT(VARCHAR(20), @Foo, 1)
declare @m moneyset @m=$1231222.9897select @mselect cast(@m as decimal(12,2))MadhivananFailing to plan is Planning to fail |
 |
|
|
|