0

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".

2
  • This sort of thing should be done in your presentation layer. So if you are exporting to excel or showing it in tableau you would format it there. Commented Feb 12, 2021 at 8:10
  • Your error is Oracle? But you have tagged SQL Server... please ensure your tags are correct. Commented Feb 12, 2021 at 10:28

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.