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 |
|
steve_c
Yak Posting Veteran
54 Posts |
Posted - 2008-02-07 : 07:59:27
|
| Hi all, I have a stored proc which produces invoicelines for a report in SSRS. The 'unitprice' field is a decimal (19,3) this is because sometimes the unit price can be 0.005 (half a cent) - most of the time however, the unitprice is in a whole value. At the moment, the data comes out like so:unitprice0.0051.500Is there any way I can present the data properly if there is not a half cent present? Like this:unitprice0.0051.50I have tried to do it in the formatting of SSRS but can't work it out... Would be grateful for any help!Thanks,Stephen. |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2008-02-07 : 08:15:45
|
| Try thisdeclare @num decimal(19,3)set @num='0.005'select cast(@num as real) |
 |
|
|
steve_c
Yak Posting Veteran
54 Posts |
Posted - 2008-02-07 : 14:21:07
|
| Hi will try that tomorrow - so that would output 0.005 as 0.005 and 1.500 as 1.50? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-08 : 01:36:40
|
| If you want to format in such a way in front end application, then use format function thereVB exFormat(col,"######.###')MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|