473,804 Members | 3,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax question whole word finding


Is there a way to construct a query to select for whole words only?

select id from bookdata where titles like '%Test%' gets everything with
test somewhere in the field. So you could get records which have test
as a subset of a larger word like 'testing' etc...

What I am interested in is finding just the individual words in a
stored field.

Say a field has 'Test your knowledge on this one.' and you want to find
'Test' or 'knowledge' the word, not test or knowledge as parts of
others words etc...anywhere and everywhere in the field and involving
many records . How can you do this? or can this be done?
Thanks for any help.

Jul 23 '05 #1
5 6601
Sri
If I understand what you are saying correctly then this will be the
query:
Select id from bookdata where titles = 'test'. This qry's result will
be only the rows whose title is test.

Let me know if this is what you wanted.
Thanks
Sri

Jul 23 '05 #2
sd********@msn. com (sd********@msn .com) writes:
Is there a way to construct a query to select for whole words only?

select id from bookdata where titles like '%Test%' gets everything with
test somewhere in the field. So you could get records which have test
as a subset of a larger word like 'testing' etc...

What I am interested in is finding just the individual words in a
stored field.

Say a field has 'Test your knowledge on this one.' and you want to find
'Test' or 'knowledge' the word, not test or knowledge as parts of
others words etc...anywhere and everywhere in the field and involving
many records . How can you do this? or can this be done?


To do this reliably in regular SQL is difficult. However, SQL Server
comes with a full-text capability, which I think could be useful here.
I have very little experience with full-text myself, but you can read
about it in Books Online.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3
Yes, I think that is what I could use.
Apparently SQlserver can make an index of words contained in the fields
Then you search - select name from bookdata where contains(name,' Word
to find')

Anyway you have to build the index before you search it. I am
interested in trying this out.
Does anyone know the syntax for creating a fulltext index?

Jul 23 '05 #4
sd********@msn. com (sd********@msn .com) writes:
Yes, I think that is what I could use.
Apparently SQlserver can make an index of words contained in the fields
Then you search - select name from bookdata where contains(name,' Word
to find')

Anyway you have to build the index before you search it. I am
interested in trying this out.
Does anyone know the syntax for creating a fulltext index?


As I said, I don't use full-text myself, but I were to look into it,
I would find the relevant sections in Books Online to study. Books Online
is by no means intended for the experts, so why don't you try the same?

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #5
'Test your knowledge on this one.'

try 'Test %' -- NOTE: the *space* before the %
should find 'Test your knowledge on this one.'
but not 'Testing your knowledge on this one.'

try 'Test%' -- NOTE: *no* space before the %
should find 'Test your knowledge on this one.'
and 'Testing your knowledge on this one.'
try '% Test %' -- NOTE: the spaces before and after the %
should find 'Need to Test your knowledge on this one.'
but not 'Test your knowledge on this one.'

where field LIKE '% Test %' OR field LIKE 'Test %' OR field LIKE '% Test'
should catch 'test' anywhere in a string
'test aaa bbb' or 'aaa test bbb' or 'aaa bbb test'

For simple cases this type of stuff can save on the overheads of full text
indexing (and managing the re-indexing of it)

Julian 8^)

<sd********@msn .com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...

Is there a way to construct a query to select for whole words only?

select id from bookdata where titles like '%Test%' gets everything with
test somewhere in the field. So you could get records which have test
as a subset of a larger word like 'testing' etc...

What I am interested in is finding just the individual words in a
stored field.

Say a field has 'Test your knowledge on this one.' and you want to find
'Test' or 'knowledge' the word, not test or knowledge as parts of
others words etc...anywhere and everywhere in the field and involving
many records . How can you do this? or can this be done?
Thanks for any help.

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1961
by: Aaron | last post by:
If i use the replace function in c# string a = "this"; a.replace("is", "something"); my output would be like thsomething how can i replace when only the whole word matches. string a = "is"; a.replace("is", "something");
3
1739
by: Giles | last post by:
Is there a way to get records containing a whole word? I've heard regular expressions can do it, but I can't make one work in an ASP / MS Access SQL Query sSQL="SELECT PageTitle FROM Pages WHERE PageTitle LIKE '%cat%' " rs.open etc returns scatty, catatonic etc. Thanks for your help Giles
4
3611
by: shonend | last post by:
I am trying to extract the pattern like this : "SUB: some text LOT: one-word" Described, "SUB" and "LOT" are key words; I want those words, everything in between and one word following the "LOT:". Source text may contain multiple "SUB: ... LOT:" blocks. For example this is my source text:
4
4810
by: seannakasone | last post by:
Is there a way to search a string for a whole word w/o using a regular expression? i.e. mystring.IndexOf(mypattern, *WholeWord); The reason i rather not use a regular expression is because sometimes i want to search for whole words w/o the regular expression special characters being interpreted.
1
1428
by: Buddhist[CHinA] | last post by:
I mean I wanna search a string in certain text files. But I don't know how to effectively get a whole-word match result. Can someone do me a favor? thx.
1
9080
by: Michael Yanowitz | last post by:
Hello: I am hoping someone knows if there is an easier way to do this or someone already implemented something that does this, rather than reinventing the wheel: I have been using the string.replace(from_string, to_string, len(string)) to replace names in a file with their IP address. For example, I have definitions file, that looks something like: 10.1.3.4 LANDING_GEAR 20.11.222.4 ALTIMETER_100
2
1429
by: summersurfer25 | last post by:
Hello, I am new with C# but have experienced in other similar languages such as Java. What I am trying to do is search a long .l5k file for any time a line begins with "f_". Once I find this line, I want to grab the whole "f_" phrase i.e. "f_someRandomTextFollows". How do I grab the whole word by just knowing the index and not knowing the length? Thanks for any comments.
17
2147
by: denakaraj | last post by:
Hi All, i am new to VB. below is the scenario I am having 2 Textboxes say Text1 and Text2 i need to find the Text2.text in the Text1 with whole word constraint i would like to get coding for this. please help me on this. Example Scenario: Text1:
3
4342
by: Tre MoR | last post by:
Regular Expression: how match a whole word? Hi All, First of all, I’d express all my gratitude to all whom will help me about this topic. I have a question about the Regular Expression Engine, the issue of mine is: Can I match an entire word using negative clauses? In English: I’ve a simple text as: “man,men,mon,mun,car,cer,cir” and I’d match all the words which don’t contain in the first position the letter “m”, in the second “a” and in...
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.