• Fal (3/30/2010)


    This QotD raises a point I'm always having to remind developers about, and I guess SQL guys can also do with a reminder from time to time.

    However, my 2 cents is rather than...

    declare @s-2 char(4)

    select ISNULL(convert(varchar(16),@s),'Unknown')

    ...I would use...

    declare @s-2 char(4)

    select coalesce(@s,'Unknown')

    ...which also has the ability to take more than 2 arguments.

    S.

    I, too, prefer the coalesce for this same reason. However, you will find that many prefer the isnull due to an increase in performance.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events