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 2000 Forums
 Transact-SQL (2000)
 store procedure for searching keyword...

Author  Topic 

greatnimesh
Starting Member

3 Posts

Posted - 2007-05-01 : 16:23:22
Hi all,
does anybody know how to write store procedure for searching keyword from different table.
Store Procedure accept keyword as input parameter and find record from different tables and return number of rows that match search keyword.

If anybody know then plz give me sample code for this problem.
Thanks in advance....
Bye
---------Nimesh Patel

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-04 : 09:40:10
See if this helps:

[url]http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-04 : 10:09:27
I always wonder why this is needed
Is this due to poor design?

Madhivanan

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

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-04 : 10:44:06
madhi:
probabaly yes
or he's just looking for a value and can't remember where it should be.

i know that in one of our db's we have guid's a PK's in every table.
and for example we use db search to find all tables that contain one key

greatnimesh:
you could also use full text indexing.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-05-04 : 11:06:07
I saw Free Text (the Index Server thingie) searching being used the other day. The application had checkboxes for specific scenarios, which mapped neatly on to specific values in various columns etc., but also had a "keywords" field on the form which basically did an OR CONTAINS on every column in Index Server.

So click some checkboxes, and get a fast resultset, or just type some words and get probably the same answer, but slower!

I can;t argue with the fact that that approach suits all types of users though!

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-05 : 03:50:35
Thanks. I thought only situation you need this is when you have similar tables that are created everymonth and if you are not sure which table has the value that you are looking for

Madhivanan

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

- Advertisement -