Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have a search page in my project. User tries to search on product details like
1) Name
2) Description

Here some times description my be a an anchor tag and syntac of the anchor tag is saved in Description column.

For example : Description may contain like this

<html href="/uStore/3/Category/7/Product/69/" >Mobile Phone.</html>

the description column will contain total tag syntax.

so i have placed to search like this Description like '%@Searchword%'

when User tries to search with key word "Mobile", the record is being listed out in my search
But my problem now is that when user search on word "Category" . This record is also coming out... as its anchor tag contains its syntax..
now i want a query to search a word that is present b/w >... <
i.e Only when search on Mobile Phone should be listed out

Thanks in advance... And correct anwer is highly appreciated :)
Posted

1 solution

XML
IF Contains(Description,"<html>")
BEGIN  Description Like "<html>%@Searchword%</html>"
END
ELSE  Description Like "%@Searchword%"
 
Share this answer
 
v3
Comments
jing567 17-Jul-14 2:27am    
Some times Description column may remain normal text also.... at that consition what to do?
jing567 17-Jul-14 2:30am    
Just now i tried by searching like this '>%Mobile%'

But it did not worked.... :(
ashok rathod 17-Jul-14 2:37am    
please see updated solution
jing567 17-Jul-14 2:39am    
It worked by little change

Description like '%>%' +'%Mobile%'
ashok rathod 17-Jul-14 2:41am    
please see condtional statement which will serve your both purpose

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