Using from the SQL SERVER 2012, you can use the function FORMAT
:
SELECT FORMAT(A.REALIZADO,'#,0.0000', 'pt-BR') ...
Using only the pattern '#0.0000' will format the display using punctuation, but will be displayed according to the setting SQL Server, which, if configured in English for example, will display "61,274,436,2090". To display in the correct format, use the last parameter, which is "culture", in the example, I used "en-BR" to display dots in the thousands and comma in the decimals.
Can be used with both numerical and date types, check the table on the link above with the documentation.
Define readable for those who interpret them
– Leandro Angelo
I imagine that’s
sql-server
on account of the functiondatepart
correct? What would be readable for you? Round?– Ricardo Pontual
@Leandroangelo in this case, I would like to insert the scores in their correct positions.
– Gabriel Paixão Justino
It’s Sql-server even @Ricardopunctual, I don’t want to round them up, just insert the scores in their proper places.
– Gabriel Paixão Justino
This should be done in your application through masks, otherwise you will no longer have numerical values, only texts. Where you display this information and what else you do with it after the query?
– Leandro Angelo
Like: "61.274.436,2090003"? But the user/you will read the direct result of
sql
or in an application (form, web page, etc)? Because the responsibility of formatting is the presentation, but if you don’t have it, only the result of the database is possible to format– Ricardo Pontual
If you use
SQL Server 2012
or more current, has the function format:select FORMAT(61274436.2090003,'#,0.0000', 'pt-BR')
, see if this is what you need that I put in a more detailed answer– Ricardo Pontual
That’s just what I need @Ricardopunctual.
– Gabriel Paixão Justino