babelfish_extensions icon indicating copy to clipboard operation
babelfish_extensions copied to clipboard

COALESCE() T-SQL function does not work with different data types

Open robverschoor opened this issue 1 year ago • 0 comments

The COALESCE() T-SQL function throws invalid input syntax error when its arguments are of not the same data type:

1> SELECT COALESCE(NULL, 1, 2, 'I am a string')
2> go
Msg 22, Level 16, State 1, Server BABEL, Line 1
invalid input syntax for integer: "I am a string"

In SQL Server,:

1> SELECT COALESCE(NULL, 1, 2, 'I am a string')
2> go
           
-----------
          1

(1 rows affected)

robverschoor avatar Dec 09 '23 10:12 robverschoor