Thursday 6 June 2013

Why we prefer COALESCE standard function instead of ISNULL Non-standard function

-- Why we prefer COALESCE standard function instead of ISNULL Non-standard function
-- Execute the  following sql statement and judge the output


DECLARE
    @x AS VARCHAR(3) = NULL,
    @y AS VARCHAR(10) = '1234567890';

SELECT ISNULL(@x,@y) AS [ISNULL], COALESCE(@x,@y) AS [COALESCE]

No comments:

Post a Comment