Jump to content

Search Among Several Sql Databases


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

Edited by aalbetski
Link to post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...