-1

I need to use the results from an Oracle query in a SQLServer query within ASP.NET. Can I do this without exporting the Oracle query results to a temp file, e.g. csv, and creating a new table in SQLServer using the csv file? Thanks!

4
  • What do you mean by "use the results ... in a SQLServer query"? Are you using the results to select certain rows from SQL Server (i.e. a where clause)? Are you trying to join the results together? Commented May 20, 2015 at 16:25
  • There's an entiry BOL section on Oracle-SQL Server migration: msdn.microsoft.com/en-us/library/hh313202%28v=sql.110%29.aspx. Did you not consider searching Google first? Commented May 20, 2015 at 16:29
  • 1
    possible duplicate of Connecting to Oracle Database using Sql Server Integration Services Commented May 20, 2015 at 16:32
  • I am limited to performing queries on my client's databases. I can't modify connections or create stored procedures. The equivalent of what I'm trying to accomplish would be something like. Select ID from Table1 where ID in (Select ID from Table2 where Client = ClientNum). However, my Table2 exists in Oracle, and my Table1 exists in SQLServer. The Oracle results need to be used in my SQLServer query, Commented May 21, 2015 at 18:05

1 Answer 1

0

There are probably several different ways to do this, including connecting the SQL Server to the Oracle server using Linked servers, But if that's not possible for some reason, or if you need to use the Oracle resultset as well as the SQL Server resultset in your asp.net page, you can fill a DataSet with the Oracle query results, and send a DataTable as a table valued parameter to a stored procedure in the SQL Server.

Look at this page in MSDN, explaining how to use table valued parameters in sql server.

You can also look here for a step by step instruction on how to create and use table valued parameters in c#.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, Zohar. We may be able to use the dataset methodology even though we can't use a stored proc. Our client has now informed us that they will probably just duplicate the Oracle table (they're running Oracle 8) into the SQLServer database which is newer technology. So this question may be moot. Thanks to all for the constructive feedback.
Sorry to hear that your client is... well... let's just say holding you back. Using sql server without being able to even write procedures is like riding a ferrary in a school zone...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.