Adding options to Parameters

  • Hi Guys,

    I want to add few filter options such as begins with, contains, ends with to the parameters.

    I attached a screen shot of it.

    In advance, I appreciate your help.

  • I don't know even know if that works but it's worth a try.

    If you add a case statement to the start of your stored procedure like

    case when @Filter = 1 then select @Search = '%' + @Search

    when @Filter = 2 then select @Search =@Search + '%'

    ... end

    I'm not sure of the syntax, but you get the idea of appending a wildcard character.

    Then use it in your query:

    ... where SearchField LIKE @Search

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

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