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)
 How to search thorugh multiple table?

Author  Topic 

neo_6053
Starting Member

24 Posts

Posted - 2009-02-11 : 04:32:01
I want to a keyword search across multiple tables. Initially, it would be easy if i just join all the table in a view. Unfortunately, my table is too huge with millions of record and i have about 20 tables. It get Timeout exception when try to run the view. Any best approach for keyword advance searching??

nr
SQLTeam MVY

12543 Posts

Posted - 2009-02-11 : 04:44:45
Have you looked at full text indexing?


==========================================
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

raky
Aged Yak Warrior

767 Posts

Posted - 2009-02-11 : 04:44:49
see this

http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm
Go to Top of Page

Doron
Starting Member

6 Posts

Posted - 2009-02-12 : 06:41:33
Write a script:

DECLARE @Results TABLE (TableName varchar(50), RowID bigint);

INSERT INTO @Results (TableName, RowID)
SELECT 'Table1', RowID
FROM Table1
WHERE Keyword='Keyword';

INSERT INTO @Results (TableName, RowID)
SELECT 'Table2', RowID
FROM Table2
WHERE Keyword='Keyword';

And so on.

The @Result temporary table will contain the results from all the tables.


Nob Hill Software - tools for database people (+ free stuff!) Nob Hill Software - tools for database people (+ free stuff!)
www.nobhillsoft.com
Go to Top of Page
   

- Advertisement -