Unexpected query output behaviour

  • Hi,

    I recently came cross some unexpected output in a query ( for me at least)

    The statement

    isnull(PAYMENT.sb_health_fund_code,isnull(replace(PAYMENT.SB_CHEQUE_DRAWER,',',' '), '')),

    was returning "DEPOSIT HU"

    as the health fund code was null, however the cheque drawer contained "DEPOSIT HUNTER MUTUAL LI K A BOLTON"

    It turns out that the health fund code field is a VARCHAR(10) field, and the output was only showing the first 10 characters.

    Is this normal behaviour in T-SQL? I cant recall seeing it before.

    Cheers,

  • It will truncate without any warnings. Have a look at 'varchar data type' in BOL, there's an example in there that demonstrates that.

    BrainDonor.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply