Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jhon11
Starting Member
42 Posts |
Posted - 2007-11-16 : 12:58:15
|
| Hi,In my query select AVG(totalpaid) as 'avg cost/30 days(physican)', from testNow Basically in that column i am getting COST..and I want to add$ sign before that...and also I want to restrict my o/p with only 3 Decimal.current result123.100129444.237800666.423878Desierd o/p$123.100$444.237$666.423Thank you |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-11-16 : 13:03:04
|
| restricting decimal can be done by doing a CONVERT(decimal(10,3), XXXX). The $ sign should, I think, be added at the front end.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
jhon11
Starting Member
42 Posts |
Posted - 2007-11-16 : 13:09:59
|
| I am getting following error..by doing that stuff.Error converting data type varchar to numeric. |
 |
|
|
jhon11
Starting Member
42 Posts |
Posted - 2007-11-16 : 13:12:43
|
| in ur giving suggestion...where its CONVERT( decimal(10,3), XXXX)Wht should i put??Should I put CONVERT(decimal(10,3),totalpaid)orShould I put CONVERT( decimal(10,3),'avg cost/30 days(physican)') |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-11-16 : 14:15:05
|
| Formatting is not something that should be done in T-SQL; you should format your results at your presentation layer -- i.e., wherever you are ultimately displaying the results, such as on a report, a web page, Excel, windows app, etc. Just return raw data from your database.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
|
|
|
|
|