Insert row into linked server view

  • Dear,

    I have two servers Server1 & Server2. Server1 is using SQL 2008 R2 64 bit and Server2 is using Oracle 11g 64 bit. I configured linked server from SQL to Oracle using Oracle Provider for OLE DB.

    Now I want to write an insert command that will fetch information from Table1 which is on Server1 and store into View1 which is on Server2.

    So I have to insert data into a view named View1. Please tell me how to insert into a view in Oracle.

    Please help me, urgently needed.

  • assuming the Oracle view is updatable because it has no aggregates or calculated columns, it's exactly the same as any other insert.

    if it's not, you have to insert into the underlying tables themselves.

    DECLARE @Criteria int = 42

    INSERT INTO MyOracle..Username.TableName(ColumnList)

    SELECT MyAlias.ColumnList

    FROM

    MySQLServer.DatabaseName.SchemaName.TableName MyAlias

    WHERE MyAlias.Criteria = @Criteria

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply