I have a couple floating, which are very large. There are about 100 million of them.
I would like this number to be displayed as follows: 123 456 789.01234
I found that I can use CONVERT if it is a data type of money, but it does not do the full trick (it leaves some decimal places).
I should have commas on the left and five decimal places on the right.
Is there a built-in SQL function to help with this? Or do I need to write a custom function?
thanks
*** Update
DECLARE @f FLOAT SET @f = 123456789.01234 SELECT LEFT('$' + CONVERT(VARCHAR(20), CAST(@f AS MONEY), 1), LEN(@f) - 2)
this will reduce it to two decimal places for formatting. You can change LEN (@f) - 2 to change this setting.
if you just display it as text, you can do the following:
oracle:
select to_char(123456789.01234,'999,999,999.99999') from dual; => 123,456,789.01234
MySQL:
select format(123456789.01234,5) => 123,456,789.01234<br>
MySQL function rounds
Source: https://habr.com/ru/post/1703383/More articles:Run the SSIS package created using VS2008 on SQL Server 2005 - sql-server-2005Why does the full-text string search "FDR" not return results in MySQL? - mysqlThe correct way to clear a constant thread in C # - multithreadingWhy is my asp.net caching throwing an exception? - cachingWindows service stops and starts immediately, but it should not - c #pthreads - how to parallelize work - multithreading"method overload" in javascript - javascriptApplescript, multiple monitors and maximum window sizes - applescriptUnderstanding CLS Compliance and Correct Code - vb.netUse computed property as DisplayColumn in ASP.Net dynamic data? - asp.netAll Articles