Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get only two decimal points in money datatype in SQL Server

SELECT ROUND(123.4567, 2)` gives me `123.4600`

But I need 123.46.

Data type of field is money.

Solution:

<%# DataBinder.Eval(Container.DataItem, "FieldName","{0:0.00}") %>
like image 565
IsmailS Avatar asked Aug 18 '10 07:08

IsmailS


2 Answers

SELECT CAST(ROUND(123.4567, 2) AS MONEY)

Will do what you are after

like image 135
Neil Knight Avatar answered Sep 28 '22 19:09

Neil Knight


If applicable, format on the view layer, not on the data layer, i.e. read all the data and truncate it later (such as in C# client)

like image 21
abatishchev Avatar answered Sep 28 '22 18:09

abatishchev