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)
 Select text from phrase

Author  Topic 

ZoneFX
Starting Member

17 Posts

Posted - 2008-04-21 : 15:58:32
I have a repository with about 10,000 records. These records are selectable by searching by author surname, this works fine, but. the powers that be would like the data to be searchable by phrase. The db lives on a commercial host where I'm unable to create full text search catalogues.

I'd like to be able to return all results that contain both terms, or either if someone types in (for example) Breast Cancer. The search will only select from the the one field which will contain complex phrases such as "Second-line treatment of postmenopausal women with advanced breast carcinoma"

Any help on creating a select query that will do this will be greatly appreciated...

nr
SQLTeam MVY

12543 Posts

Posted - 2008-04-21 : 16:14:29
>> The db lives on a commercial host where I'm unable to create full text search catalogues.
Sounds like you might want to review this - maybe col-location where you have your own server and you can do what you want with it.

where fld like '%' +@phrase + '%'
will go some way towards it.

You then probably want a table which holds different forms of the words

cancer
cancers
carcinoma
carcinomas
....
maybe
melinoma
....

Then split your phrase into words, match against this lookup table and search for all possible forms of the phrase.



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -