Sunday, February 19, 2012

how to do a word search?

I need to be able to search article in several tables in a MSSQL DB. What is the best way to do a word search? Are there and freebies out there or code examples?

Dave

Let's say you want to search for the word vb.net in multiple databases but want to return it as a single result set. You would do this

Select Article from Database1.OwnerOfTable1.Table1

WHERE Article like '%vb.net%'

UNION

Select Article from Database2.OwnerOfTable2.Table2

WHERE Article like '%vb.net%'

|||But how do you show the results?|||

Hi

You could use simple "like" clause to search different tables.

Full-Text search might be better in performance here is an article: Setting Up Full Text Search: A Step-by-step Guide

No comments:

Post a Comment