Dhenn
Dhenn

Reputation: 295

searching records from multiple databases

I have more than 10 databases with same tables but different records.

Now I would like to have a search engine that can search all the databases. Let say for example I am going to search for a person by last name or first name, then the search must go to all of the databases, the query will search all the databases.

How can i do that?..

Do you have sample code for ASP.NET C#? thanks!

Upvotes: 0

Views: 741

Answers (1)

Sunil Chavan
Sunil Chavan

Reputation: 524

Hi @Dhenn create a view in your one database by union on the 10 tables and you can get easy search on that

table1 is in database1 and table2 is in database2 then

 select * from  database1.dbo.table1. 
union all

 select * from  database2.dbo.table1. 

.
.
.

other option you can fire 10 hits to 10 databases from asp.net c# and then merge result and show on screen.

Please Ref this

Upvotes: 1

Related Questions