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.
| Author |
Topic |
|
sudheepdivakar
Starting Member
5 Posts |
Posted - 2009-08-29 : 14:24:59
|
| Hi,I need to write a function which takes two inputs, a big string and a search string, and then returns the number of occurrences. Eg 1: Arg 1 = "Women's or girls' suits, ensembles, jackets and blazers, dresses, skirts, divided skirts, trousers, bib and brace overalls, breeches and shorts (other than swimwear), knitted or crocheted" Arg 2 = "mens"in the above case the function should return 0.Eg 2:Arg 1 = "Track suits, ski suits and swimwear, knitted or crocheted. # Track suits: # Of synthetic fibres # Of polyesters, not brushed or fleeced"Arg 2 = "NOT BRUSHED"in the above case it have to return 1The important thing here is, it should be a exact match. Eg: word "womens" contains "mens" but it should return me 0.Please help me to write the funtion.ReardsSudheep |
|
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2009-08-29 : 22:14:31
|
quote: The important thing here is, it should be a exact match.Eg: word "womens" contains "mens" but it should return me 0.
Technically speaking, that is an exact match.You might be able to do that by including space in the search but you will not be able to deal with situations like this.Arg 1 = "Track suits, ski suits and swimwear, knitted or crocheted. # Track suits: # Of synthetic fibres # Of polyesters, not brushed or fleeced"Arg 2 = "BRUSHED"Return 1Would you consider that a mismatch if "brushed" was found in the above string when it really contains "not brushed"?An infinite universe is the ultimate cartesian product. |
 |
|
|
sudheepdivakar
Starting Member
5 Posts |
Posted - 2009-08-30 : 01:35:01
|
| Yes, it would be considered as mismatch, because I am searching for "not brushed" and not for "brushed".Are you asking me to search for " mens " (with space on both sides) other than "mens" ? |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-08-30 : 09:21:06
|
| You could use FULLTEXT searching. Would this be feasible in your environment? |
 |
|
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2009-08-30 : 10:19:01
|
quote: Originally posted by sudheepdivakar Yes, it would be considered as mismatch, because I am searching for "not brushed" and not for "brushed".Are you asking me to search for " mens " (with space on both sides) other than "mens" ?
You misunderstand my question. *If* you were searching for "brushed" you would certainly get hits where "not brushed" was in the string. There's no easy way around this problem.An infinite universe is the ultimate cartesian product. |
 |
|
|
|
|
|
|
|