Jump to content

Search Among Several Sql Databases


Matteo

Recommended Posts

I am looking for a script or query that will allow for a common keyword search across several databases and return one consolidated recordset. Has anyone ever done something similar, do you have any ideas on how to create the necessary coding?The only solution I can think of atm is to create a separate database that has a single table to hold the query results from each database query request, but I am hoping there is a more seksi, i.e. streamlined approach.

Link to comment
Share on other sites

using SQL Server, you can query multiple databases provided that they are all on the same SQL Server. If multiple SQL servers are involved, you'd need to set them up as linked and then should be able to do the samei.e. select top 1 accountid from database1.dbo.table1unionselect top 1 accountid from database2.dbo.table1

Link to comment
Share on other sites

using SQL Server, you can query multiple databases provided that they are all on the same SQL Server. If multiple SQL servers are involved, you'd need to set them up as linked and then should be able to do the samei.e. select top 1 accountid from database1.dbo.table1unionselect top 1 accountid from database2.dbo.table1
Ok, I'll try that. Thanks.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...