Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 MS SQL Server stored procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-06-19 : 18:49:59
Raj writes "Hi,
For a search jobs application, I am accepting multiple keywords from the user with a delimiter ','. I have a keywords field in my table which accepts, again, multiple keywords with a ',' delimiter. I can split the user input by the delimiter and seperate them into individual keywords. after this I can check them against the keywords field in my table. If keywords field has only one keyword then I find the match and display some details.This part works fine. My problem is if my keyword field has multiple keywords seperated by a ',', how do I compare the individual keywords with the multiple keywords in my table and still get all the right results based on those keywords? The above described procedure doesn't work here because I am comparing individual keywords(after seperation)with the multiple keywords in the table. whats the solution for this?

Eg. user inputs ASP.NET,C#,VB.NET, I can split them and compare these individual keywords with the keywords field in my table and display some results. This workd if I have ASP.NET
or C# or VB.NET are in seperate rows in my keywords field.
If my keywords field has ASP.NET,C# and the user input is just ASP.NET, The keywords field in the table wont match with the user input so I get no output. what I want to see is if user gives ASP.NET, this should be compared with ASP.NET,C# and show him the results.
How to achieve this?"

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-06-19 : 21:21:18
there is a split function here somewhere, search for fnsplitText (i think...), what it does is it accepts a string of values separated be a delimiter, then splits it into individual words and saves this in a temp table, the table is then used in the where clause using the IN keyword

HTH

--------------------
keeping it simple...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-19 : 21:25:52
here it is http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-20 : 02:58:42
or use

where ','+@SearchString+',' like '%,'+Column+',%'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -