locked
Parameter spacing RRS feed

  • Question

  • User-1355132948 posted

    hi there 

    I used the RTRIM and LTRIM sql functions in my rdl report in order to remove any spacing in my parameters BUT the query still doesn't work ! what would be the possible problem !?

    the query as follows

    SELECT DISTINCT Equipments.Model_Name, Equipments.BME_No, Equipments.Equipment_Name, Equipments.Description
    FROM            Equip_Manu_Bridge INNER JOIN
                             Equipments ON Equip_Manu_Bridge.Equipment_ID = Equipments.Equipment_ID INNER JOIN
                             Manuals ON Equip_Manu_Bridge.Manual_ID = Manuals.Manual_ID
    WHERE        (Equipments.BME_No LIKE LTRIM(RTRIM(@BME_No)) OR
                             Equipments.BME_No LIKE NULL) AND (Manuals.Type = 'Service') OR
                             (Equipments.Model_Name LIKE '%' + LTRIM(RTRIM(@ModelN)) + '%' OR
                             Equipments.Model_Name LIKE NULL)


    any help please =)

    Tuesday, July 24, 2012 8:39 AM

Answers

  • User-784583665 posted

    use this

    SELECT DISTINCT Equipments.Model_Name, Equipments.BME_No, Equipments.Equipment_Name, Equipments.Description 
    FROM            Equip_Manu_Bridge INNER JOIN 
                             Equipments ON Equip_Manu_Bridge.Equipment_ID = Equipments.Equipment_ID INNER JOIN 
                             Manuals ON Equip_Manu_Bridge.Manual_ID = Manuals.Manual_ID 
    WHERE        (Equipments.BME_No LIKE '%' + LTRIM(RTRIM(@BME_No) + '%') OR 
                             Equipments.BME_No LIKE NULL) AND (Manuals.Type = 'Service') OR 
                             (Equipments.Model_Name LIKE '%' + LTRIM(RTRIM(@ModelN)) + '%' OR 
                             Equipments.Model_Name LIKE NULL)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 24, 2012 8:45 AM

All replies

  • User-784583665 posted

    use this

    SELECT DISTINCT Equipments.Model_Name, Equipments.BME_No, Equipments.Equipment_Name, Equipments.Description 
    FROM            Equip_Manu_Bridge INNER JOIN 
                             Equipments ON Equip_Manu_Bridge.Equipment_ID = Equipments.Equipment_ID INNER JOIN 
                             Manuals ON Equip_Manu_Bridge.Manual_ID = Manuals.Manual_ID 
    WHERE        (Equipments.BME_No LIKE '%' + LTRIM(RTRIM(@BME_No) + '%') OR 
                             Equipments.BME_No LIKE NULL) AND (Manuals.Type = 'Service') OR 
                             (Equipments.Model_Name LIKE '%' + LTRIM(RTRIM(@ModelN)) + '%' OR 
                             Equipments.Model_Name LIKE NULL)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 24, 2012 8:45 AM
  • User-1355132948 posted

    Oooh it's working =D 

    would you please explain the difference between the 2 queries ?

    I mean what made it work using the 2nd query ?

    thanks a lot 

    Tuesday, July 24, 2012 9:01 AM