How to do with wildcard search!

Hi all!

I was looking to biuld sql statemenet where a wildcard search should be included on one of the criteria/field. For example if I gave words like "search" "searchs" and "search's" it should return all the values under that specific field having all or two or one of these words.

Would you mind helping me how to construct the sql statemenets please

Thank you in advance.




Answer this question

How to do with wildcard search!

  • TA123

    Use the like operator: http://msdn.microsoft.com/library/default.asp url=/library/en-us/tsqlref/ts_la-lz_115x.asp

    Select * FROM MyTable Where (TheSearchField Like "search%")



  • Alan Z

    Than you for your response but still the problem is:

    What if you didn't know what is going to be given as an input.I mean it is something that the user is going to type in a textbox.The input to the textbox is unknown. It can be one of the 3 listed in the first post. or we can take examples like:

    disease,diseases and disease's

    Thank you!



  • eigo

    you can customize your SQL statement before executing

    mySqlStatement = "Select * FROM MyTable Where (TheSearchField Like " & text1.text & "%)"


  • How to do with wildcard search!