Click here to Skip to main content
16,020,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am facing problem to write search query in sqlserver for search engine.
I have a textbox and button.
I want to search any word on button click through sqlserver query.But this query gives only matching word.
For Example when I enter tata it gives the result but when we enter tata123 it gives no output.

My Sqlserver query is:
"
SQL
select distinct top 20 s.title,s.Short_Description,s.primary_keyword,p.cat_id,s.art_id from tbl_summary s inner join tbl_publishinfo as p on p.art_id =s.art_id where s.art_id in(select pi.art_id from tbl_publishinfo pi group by pi.art_id having(count(pi.art_id)=1)) and s.title like'%" & txttext & "%' order by s.art_id desc"
Posted
Updated 27-Feb-12 18:24pm

Hi,
What you are looking for can be done easily using full text catalog.
This searches for part or complete string on multiple fields.

Have a look on the following links.


Description of Full Text
http://msdn.microsoft.com/en-us/library/ms142571.aspx[^]


How to Use:
http://msdn.microsoft.com/en-us/library/ms142583.aspx[^]
 
Share this answer
 
Comments
Tech Code Freak 28-Feb-12 5:33am    
5up!
 
Share this answer
 
VB
for example

dim str as string
str= select * from tablename where column name='"&textboxName&"'


try it
 
Share this answer
 
You need to enable full text search on the target Sql Server success depends on you table design too then create a full text catalog then you can search the way you want to.

Do some Google search or try links given by Mr Ankit

Best of luck
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900