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 2005 Forums
 Transact-SQL (2005)
 full text search to match pipe separated data

Author  Topic 

sandeepmgupta
Starting Member

4 Posts

Posted - 2010-04-28 : 07:55:13
I have a column with datatype nVarchar which contains pipe separated data like 1|10|11|5|4.
Is there any way to match exact number(s) using full text search or any other way?
If I search for 1 it should return only 1 not 10 or 11 as "Like" keyword returns records with 1,10,11.

I am storing in this way to avoid join query which is reducing speed.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-28 : 08:40:59
quote:

I am storing in this way to avoid join query which is reducing speed.




Try
where '|'+yourColumn+'|' like '%|1|%'



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-28 : 08:50:44
<<
I am storing in this way to avoid join query which is reducing speed.
>>

No. Are you sure about it?

Madhivanan

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

sandeepmgupta
Starting Member

4 Posts

Posted - 2010-04-28 : 09:10:16
quote:
Originally posted by madhivanan

<<
I am storing in this way to avoid join query which is reducing speed.
>>

No. Are you sure about it?

Madhivanan

Failing to plan is Planning to fail



I have heard that full text search works much faster than like keyword.
Solution of webfred is working for me.
Is this same possible with full text search? If yes how?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-28 : 09:34:19
Please read this from page 1 to page 7 to get a fast overview or have a look in google
http://aspalliance.com/1512


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sandeepmgupta
Starting Member

4 Posts

Posted - 2010-04-28 : 10:41:50
quote:
Originally posted by webfred

Please read this from page 1 to page 7 to get a fast overview or have a look in google
http://aspalliance.com/1512


No, you're never too old to Yak'n'Roll if you're too young to die.


I went through the article but found nothing helpful for my scenario.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-28 : 11:06:36
quote:
Originally posted by sandeepmgupta

quote:
Originally posted by webfred

Please read this from page 1 to page 7 to get a fast overview or have a look in google
http://aspalliance.com/1512


No, you're never too old to Yak'n'Roll if you're too young to die.


I went through the article but found nothing helpful for my scenario.


That is a little bit funny.
You have stated that you "have heard that full text search works much faster than like keyword"

So my guess was that you don't know know anything about full text search.
So my guess was that no full text search is installed on your system.
So my guess was that it would be fine to get an overview "what full text search is".
My guess was not that the link is THE solution to your problem but it is a way to come closer...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sandeepmgupta
Starting Member

4 Posts

Posted - 2010-04-28 : 11:17:28
quote:
Originally posted by sandeepmgupta

quote:
Originally posted by webfred

Please read this from page 1 to page 7 to get a fast overview or have a look in google
http://aspalliance.com/1512


No, you're never too old to Yak'n'Roll if you're too young to die.


I went through the article but found nothing helpful for my scenario.



I have three rows "10","10|48","11|10|1" and column "imagecategory" with full text indexed.
With the help of
select imageid,imagecategory from images where contains (imagecategory,'"10"');
it returns all above records.
But with records like "1","1|5","3|1|2"
select imageid,imagecategory from images where contains (imagecategory,'"1"');

no results found

Why?
Go to Top of Page
   

- Advertisement -