| Author |
Topic |
|
nt4vn
Yak Posting Veteran
98 Posts |
Posted - 2009-02-27 : 10:20:03
|
| Hello:I want to format this statement to show AvgRtn in currency:sum(am_collections)/count(distinct dt_pd_acct_begin) as AvgRtnright now it came out like: 781.18750000000000000000000Thanks, |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-27 : 10:36:29
|
| What do you want your output to look like? |
 |
|
|
nt4vn
Yak Posting Veteran
98 Posts |
Posted - 2009-02-27 : 10:40:32
|
I want it show like $781.19Thanks,quote: Originally posted by vijayisonly What do you want your output to look like?
|
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-27 : 10:57:03
|
| Try this.SELECT '$' + CONVERT(CHAR,CAST(ROUND(AvgRtn,2) AS DECIMAL (10,2))) |
 |
|
|
nt4vn
Yak Posting Veteran
98 Posts |
Posted - 2009-02-27 : 11:21:58
|
It's exactly what I am looking for.Thanks so much!quote: Originally posted by vijayisonly Try this.SELECT '$' + CONVERT(CHAR,CAST(ROUND(AvgRtn,2) AS DECIMAL (10,2)))
|
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-27 : 11:26:35
|
Welcome |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-03-02 : 03:32:25
|
quote: Originally posted by nt4vn I want it show like $781.19Thanks,quote: Originally posted by vijayisonly What do you want your output to look like?
If you use front end application, do the formation thereMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-02 : 10:26:01
|
| and you've lots of currency formatting functions available at front end application to do this |
 |
|
|
nt4vn
Yak Posting Veteran
98 Posts |
Posted - 2009-03-03 : 08:48:40
|
Yes, you are right. I could not sum the amount when I export data to excel. How would I correct the format in sql transaction to make it work in Excel.Thanks,quote: Originally posted by visakh16 and you've lots of currency formatting functions available at front end application to do this
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-03 : 08:57:42
|
| for changing format in sql, you've to convert it to varchar which will cause problems when you use currency value for comparison, sorting,... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-03-03 : 09:00:10
|
quote: Originally posted by nt4vn Yes, you are right. I could not sum the amount when I export data to excel. How would I correct the format in sql transaction to make it work in Excel.Thanks,quote: Originally posted by visakh16 and you've lots of currency formatting functions available at front end application to do this
If you export data to EXCEL, format data thereMadhivananFailing to plan is Planning to fail |
 |
|
|
nt4vn
Yak Posting Veteran
98 Posts |
Posted - 2009-03-03 : 09:19:17
|
quote: Originally posted by madhivanan
quote: Originally posted by nt4vn Yes, you are right. I could not sum the amount when I export data to excel. How would I correct the format in sql transaction to make it work in Excel.Thanks,quote: Originally posted by visakh16 and you've lots of currency formatting functions available at front end application to do this
If you export data to EXCEL, format data thereMadhivananFailing to plan is Planning to fail
Yes I got it work now by exporting all to excel. Thanks All! |
 |
|
|
|