Searching company name in Sql server Stored procedure

I need a search query stored procedure through which I can check a particular search criteria using keyword, particular word or some phrase. For e.g. my company name is "Experts exchange india pvt ltd". Now if I search with a keyword like "Experts" then it should show all the companies listing with keyword Experts in it.  Now suppose I search with "Experts India ltd" then also it should show the same results with the companies with the same names listing. Can you please provide me some stored procedure or query for this?
GurbirsAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
brad2575Connect With a Mentor Commented:
The search I described would not work then.  You would have to break the search string up by spaces and do a where like '%%' for each part of the search string.

So you would do this:
WHere CompanyName like '%Experts%' AND CompanyName like '%Ltd%'

Depending on the language you are using to code in you would have to build the where clause in different ways.  You could split the search string up by spaces into an array and loop the array to dynamically build the where clause like above.
0
 
brad2575Commented:
Yes just use

Select * From CompanyTable
where CompanyName like '%Experts%'

The like and any text in the middle of the 2 "%%" act as wild cards so it will find anything in a field that is like what you are looking for.
0
 
GurbirsAuthor Commented:
But if the company name is Experts Pvt. then it is showing nothing. Can you suggest?
0
 
GurbirsAuthor Commented:
I mean the company name is  Experts India Pvt ltd and the keyword searchd is "Experts Ltd", here it is not showing anything
0
All Courses

From novice to tech pro — start learning today.