Run time parameter with wildcards - Strike Two

(3 posts) (2 voices)

Tags:

  1. werner, Member

    Hi

    I have managed to insert a wildcard parameter but I don't really want the user to enter %something% in the input box.

    I have tried to have a number of combinations in SQL, like '%inMedicine%' and
    '%' inMedicine '%', but it does not work.

    Any suggestions will be most welcome.

    Thank you again very much.

    Werner

  2. myDBR Team, Key Master

    Hi,
    what you need to create is a comparision string with starting and ending with '%'. Assuming you are using MySQL, you can use CONCAT-function:

    SELECT *
    FROM mytable
    WHERE item LIKE CONCAT('%', inMedicine, '%');

    --
    myDBR Team

  3. werner, Member

    Excellent! That works likes a charm. Thank you very much.


Reply

You must log in to post.