Using LIKE in a stored procedure

  • Hope someone can help me out here.

    I am trying to write a stored procedure that will us a LIKE in the where clause. But I can not get it to work! I have looked around on the internet and all the suggestions I find I can not get to work.

    Please see my code below.

    DECLARE PROCEDURE bsp_ProductionEngineeringNonBom

    @PartNum CHAR(22)

    AS

    SELECT partnum

    ,sm

    ,partdesc

    ,prodgroup

    FROM dbo.partmaster

    WHERE partnum LIKE RTRIM(@partnum) + '%'

  • Found the problem!

    I was declaring @PartNum as a CHAR(22) changed to VARCHAR(22) and it worked!!! 🙂

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

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