Falcon
Falcon

Reputation: 73

Create separators in sql query

Is there an option to create separators in sql query?

EXECUTE ('
Select 
A 
from dbo.Table') AT BAZ_PROD

   A    |
---------
92759.4 |

I want to see: 92 759.4 instead of 92759.4

i tried

EXECUTE ('
Select 
FORMAT(A, ''###,###,###.##'') AS A
from dbo.Table') AT BAZ_PROD

and have error:

The OLE DB provider "OraOLEDB.Oracle" for the linked server "BAZ_PROD" returned the message "ORA-00904:" FORMAT ": invalid ID".

Upvotes: 0

Views: 1732

Answers (2)

SQLpro
SQLpro

Reputation: 5113

in SQL Server you must use the FORMAT function to do so.

SELECT FORMAT(92759.4, '00 000.00')

The remaining probleme will be the leading 0

But, because this is a cosmectic question, you must not do that at the RDBMS level, but, instaed, at the application level.

Upvotes: 1

Levent Üncü
Levent Üncü

Reputation: 335

You can use TO_CHAR function, you can find some good example in https://www.techonthenet.com/oracle/functions/to_char.php

for formatted numbers also you can look at this answer.

Upvotes: 1

Related Questions