Why do you think, that you even had commas ?
The documentation says nothing about formatting value.
MONEY and SMALLMONEY are currency numeric data types. The scale for currency data types is always 4.
SELECT CAST('123123' AS money)
this query will return 123123.0000
, as expected
As I see, at least there are two ways how to do it.
- Define your own datatype, same as %Currency as an example, where you can change scale number, and format. But you should change to this type all properties, in all classes, where you need it.
- Or you can define new SQL Function, which will format all numbers as needed.
Something like below:
Class Sample.Utils Extends %RegisteredObject
{
ClassMethod ToMoney(pValue As %Integer = 0) As %String [ SqlProc, SqlName= "TO_MONEY"]
{
quit "$ " _ $fnumber(pValue, ",", 2)
}
}
And Query SELECT Sample.TO_MONEY(1234567)
, will return $ 1,234,567.00