So I have two systems I often have to join together to display certain reports. I've got one system that stores metadata on documents that is stored in SQL Server, usually by part number. The list of part numbers I would want to get documents for come from an Oracle table in our ERP system. My current method goes like this:
DataTable
. string[]
of part numbers from a column. IN()
statement to get all document information from docs (MSSQLSVR) system into another DataTable
. DataTable
, loop through rows. DataTable
, if(erpRow["ITEMNO"] == docRow["ITEMNO"])
This, to me feels really inefficient. Now obviously I can't use one connection string to JOIN
the two tables, or use a database link, so I assume there will have to be two calls, one to each database. Is there another way to join these two sets together?
I would suggest a LikedServer approach ( http://msdn.microsoft.com/en-us/library/ms188279.aspx ). Write a Stored Procedure on the SQL Server side that pulls the data over from an Oracle Linked Server, does the JOIN locally and returns the combined data.
SQL Server has been designed to execute JOINs efficiently. No need to try to recreate that functionality in the app layer.
Since you've ruled out a database link I would do the following
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.