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
 Import/Export (DTS) and Replication (2000)
 Pass-Through query from SQL Server 2000 to Oracle 8i

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-01 : 08:48:45
Eric writes "I have a database on an instance of SQL Server 2000 in which I need to update from an Oracle 8i database instance. The Oracle 8i database is across a VPN and joining tables between the two is extremely slow. So, I figured out how to use the OPENQUERY function in SQL Server 2000 for passing a query to ORACLE and return a result set. The problem is OPENQUERY does not take variables for its parameters. I need to be able to create a query on the fly (from stored proc or from an app) to send as a pass-through to the ORACLE database so I can process the results into my SQL database. Is there another function provided by Microsoft to do this, or could I set up something different between the two to speed things up?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-03-01 : 09:00:40
You can use dynamic SQL to create the statement you want, and use the EXECUTE command to run it. This thread actually has a good example of exactly what you need:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=13397

For more info on dynamic SQL, read these:

http://www.sqlteam.com/item.asp?ItemID=4599
http://www.sqlteam.com/item.asp?ItemID=4619

Go to Top of Page
   

- Advertisement -