SQL Linked Server Connection to Oracle

rr-4098 2,051 Reputation points
2025-06-04T20:41:16.1066667+00:00

I have a linked server connection between my SQL server and remote Oracle server. I can query the Oracle server from SQL without issue. I need to insert data from SQL into Oracle. The problem is the table names in SQL are different than Oracle. I tried using a select as statement inside the value command and it did not like it.

I was thinking about maybe reading the SQL data into a temp table or variable but wanted to get others thoughts on this.

SQL Server SQL Server Transact-SQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2025-06-04T21:10:52.6133333+00:00

    In theory, you should be able to do:

    INSERT ORACLESVR.catalog.schema.tbl(col1, col2, col3)
       SELECT ...
       FROM  localtbl
       WHERE ...
    

    But this often breaks down for various reasons. It's usually easier to run the INSERT statement on the target side, but I don't what Oracle supports in that area.

    I'm not sure what you mean with using a temp table or table variable. I can't see how that could make things easier.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.