6 thoughts on “Question of the month January 2015 – which statement throws an error?

  1. SELECT COALESCE(‘TEST’,100.25) , because before evaluating the function i.e. NULL check, SQL Server tries to do an implicit conversion of all the valuesto the highest datatype in the group.

  2. Honestly, I did not know a reply to this but questions such as these that keep the fuel burning.

    COALESCE accepts the first expression and then tries to convert the data type of the first expression, as such of second expression.Here it fails as in example second expression is an integer.

    If you change to SELECT COALESCE(‘TEST’,’A’) it will deliver the same result as of
    SELECT ISNULL(‘TEST’,100.25)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s