Stored Procedure Input Parameter and LIKE

  • Hi there,

    Writing a stored procedure that takes a text string and performs a search using the LIKE keyword. It then returns the row count using an output parameter. A seperate output parameter returns the row count of a seperate select query.

    My problem is that I cannot seem to find the syntax for using wildcards within the LIKE clause. I would like to achieve the equivalent of

    Select....Where....LIKE '%text%'

    but using the declared input parameter instead of the text bit. Have tried;

    LIKE @input_parameter

    LIKE @input_parameter + '%'

    LIKE '%input_parameter%'

    Cant seem to get the required result.

    Any help greatly apprecaited.

    Rolf

  • Its ok sorted it out now...just a typo!

    DOH.

    where ..LIKE '%' + @input_parameter + '%'

  • where ..LIKE '%' + rtrim(@input_parameter) + '%'

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

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