Sample Header Ad - 728x90

Why is COALESCE not a function?

23 votes
2 answers
5695 views
[The docs](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/coalesce-transact-sql?view=sql-server-ver16#comparing-coalesce-and-isnull) insist that ISNULL is a function, but COALESCE is not. Specifically, they say > The ISNULL function and the COALESCE expression If I put on my Lisp hat, I can think of COALESCE as a macro and everything makes sense. However, I've never needed such thinking in T-SQL. So, I must ask. In T-SQL: 1. What is the definition of a function? 2. What is the definition of an expression? 3. How can I tell the difference between a function and an expression?
Asked by J. Mini (1237 rep)
Apr 28, 2024, 12:12 PM
Last activity: Apr 30, 2024, 02:44 PM