Data Type Mismatch when updating with concatenation

  • I've got basic DTS and querying skills in SQL and Access.

    To begin, a DTS Package drops/creates tables in an Access db then transforms/copies data from an SQL db to the Access db. I'm trying to concatenate data from three fields into one inside the Access db using the DTS Package. I'm getting a "data type mismatch error in criteria expression". See code:

    UPDATE DBO_PO_ITEMS

    SET POX_AD_NAME_BO = POX_NAME + ' ' + POX_UNIT + ' ' + POX_QTY

    WHERE (POX_TYPE = '4')

    I tried the criteria of '4' with and without quotes. I also tried CASTing (even though the conversions should have been implicit) but received an error that I was missing an operand.

    Am I off my rocker? Is there a better way? Am I close? Thanks in advance for your help.

  • If your POX_NAME is of varchar type and UNIT & QTY of int types then convert the 2 columns to varchar first....

    SELECT POX_NAME + SPACE(1) + CAST(POX_UNIT AS VARCHAR) + SPACE(1) + CAST(POX_QTY AS VARCHAR)
    







    **ASCII stupid question, get a stupid ANSI !!!**

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

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