babelfish_extensions icon indicating copy to clipboard operation
babelfish_extensions copied to clipboard

FORMAT() function does not handle '00.00' and #,##' masks

Open robverschoor opened this issue 1 year ago • 0 comments

The FORMAT() function does not currently supports the format masks '#,##' and '00.00'. For the examples below, Babelfish raises an error message shown for all numeric datatypes.

SQL Server:

1> SELECT FORMAT(cast(123.45 as float), '#,##')
2> go
----------------------------------------
123

1> select FORMAT(cast(123 as int), '00.00')
2> go
----------------------------------------
123.00 

Babelfish:

1> SELECT FORMAT(cast(123.45 as float), '#,##')
2> go
Msg 33557097, Level 16, State 1, Server BABELFISH, Line 1
#,## is not supported/invalid format when converting from NUMERIC to a character string.

1> select FORMAT(cast(123 as int), '00.00')
2> go
Msg 33557097, Level 16, State 1, Server BABELFISH, Line 1
00.00 is not supported/invalid format when converting from NUMERIC to a character string.

robverschoor avatar Dec 09 '23 20:12 robverschoor