Error with Query (trying to concatenate two fields)

  • Hi All,

    From what I can tell this should work but I get the following error:

    Msg 245, Level 16, State 1, Line 1

    Conversion failed when converting the varchar value 'Mins' to data type int.

    Full Code is;

    SELECTTempDB.CampaignName, TempDB.CRC, TempDB.Description, TempDB.Success, TempDB.Contact, TempDB.FinalCRC As Complete, TempDB.Recall,

    TempDB.RecallTime, CASE WHEN TempDB.Recall = '0' THEN '' ELSE TempDB.RecallTime + ' ' +TempDB.CBInfo END As CBInfo

    FROM

    (

    SELECT CRCGroup.GroupName As CampaignName, CRC.CRC, CRC.Description, CRC.Success, CRC.Contact, CRC.FinalCRC, CRC.Recall, CRC.RecallTime,

    CASE

    WHEN CRC.RecallScale = '0' THEN 'Mins'

    WHEN CRC.RecallScale = '1' THEN 'Hours'

    WHEN CRC.RecallScale = '2' THEN 'Days'

    ELSE NULL

    END AS CBInfo

    FROM CRC INNER JOIN

    CRCGroupCRC ON CRC.CRCID = CRCGroupCRC.CRCID INNER JOIN

    CRCGroup ON CRCGroupCRC.GroupID = CRCGroup.GroupID

    )TempDB

    ORDER BY Complete DESC, Contact DESC, Success DESC

  • Ah Figured it!

    SELECTTempDB.CampaignName, TempDB.CRC, TempDB.Description, TempDB.Success, TempDB.Contact, TempDB.FinalCRC As Complete, TempDB.Recall,

    TempDB.RecallTime, CASE WHEN TempDB.Recall = '0' THEN '' ELSE TempDB.RecallTime + ' ' + TempDB.CBInfo END As CBInfo

    FROM

    (

    SELECT CRCGroup.GroupName As CampaignName, CRC.CRC, CRC.Description, CRC.Success, CRC.Contact, CRC.FinalCRC, CRC.Recall, CAST(CRC.RecallTime As Char(2)) As RecallTime,

    CASE

    WHEN CRC.RecallScale = '0' THEN 'Mins'

    WHEN CRC.RecallScale = '1' THEN 'Hours'

    WHEN CRC.RecallScale = '2' THEN 'Days'

    ELSE NULL

    END AS CBInfo

    FROM CRC INNER JOIN

    CRCGroupCRC ON CRC.CRCID = CRCGroupCRC.CRCID INNER JOIN

    CRCGroup ON CRCGroupCRC.GroupID = CRCGroup.GroupID

    )TempDB

    ORDER BY Complete DESC, Contact DESC, Success DESC

  • I am curious to know that are u working for some call center....

  • I am yes, is it that obvious?

Viewing 4 posts - 1 through 3 (of 3 total)

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