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 |
|
insanepaul
Posting Yak Master
178 Posts |
Posted - 2010-11-11 : 12:33:43
|
I tried:ROUND(sil.SalesInvoiceLineAmount,2) but it still adds loads of zero's |
|
|
TimSman
Posting Yak Master
127 Posts |
Posted - 2010-11-11 : 12:37:16
|
| What is the datatype?You could try: CONVERT(decimal(18, 2), ROUND(sil.SalesInvoiceLineAmount, 2)) |
 |
|
|
insanepaul
Posting Yak Master
178 Posts |
Posted - 2010-11-11 : 12:55:16
|
quote: Originally posted by TimSman What is the datatype?You could try: CONVERT(decimal(18, 2), ROUND(sil.SalesInvoiceLineAmount, 2))
Great that worked thanks, I noticed something similar online but thought it was a lot of code! |
 |
|
|
Kwex
Starting Member
1 Post |
Posted - 2011-08-19 : 09:59:58
|
| You can also use this to ensure that the decimal places are not returned if the number is a whole number.SELECT ISNULL(CONVERT(FLOAT, ROUND(202028318.5623, 2)), 0) would yield 202028318.56and SELECT ISNULL(CONVERT(FLOAT, ROUND(343300343, 2)), 0) would yield 343300343Kwex. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2011-08-19 : 10:23:13
|
| best to do the formatting in the Application, not the database query. Not always avoidable though ... |
 |
|
|
|
|
|
|
|