Insert Data to Oracle DB table from SQL Server Table with dblink with using SQL Server

pc_coder

I have an table in Oracle named HR.ST_ADISYON_DETAY. I can send select command and get data from there such as

SELECT TOP 100 * FROM OPENQUERY([HBT_CONNECTION] , 'select * from HR.ST_ADISYON_DETAY ORDER BY TARIH DESC');

I created dblink. My dblink name is HBT_CONNECTION. I want to delete all data from table and insert new data to this Oracle database table. But I couldn't find query to do it. How can I delete and insert statement with db link. I will write it in SQL Server.

INSERT INTO HR.ST_ADISYON_DETAY(SICIL_KOD,AD_SOYAD,URUN,MIKTAR,BIRIM_FIYAT,TOPLAM,TARIH) SELECT SICIL_KOD,AD_SOYAD,URUN,MIKTAR,BIRIM_FIYAT,TOPLAM,TO_DATE(TARIH,'MM/DD/YYYY HH:MI:SS AM') FROM VIEW_HARCAMA_BYSICIL

Select part is from SQL Server. Insert part is from Oracle database.

Максим Золотенко

Try this:

DELETE FROM  HBT_CONNECTION..HR.ST_ADISYON_DETAYF

INSERT  INTO HBT_CONNECTION..HR.ST_ADISYON_DETAY(SICIL_KOD,AD_SOYAD,URUN,MIKTAR,BIRIM_FIYAT,TOPLAM,TARIH)
SELECT  SICIL_KOD,AD_SOYAD,URUN,MIKTAR,BIRIM_FIYAT,TOPLAM,TO_DATE(TARIH,'MM/DD/YYYY HH:MI:SS AM')
FROM    VIEW_HARCAMA_BYSICIL

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Data flow task not updating SQL Server table from oracle db

Insert Data to SQL Server Table using pymssql

Insert data into table in SQL Server from XML

SQL Server Insert Data From Other table

SQL Server 2012: Copy table structure with data from one DB server to other using Linked Server

SQL Server Local DB cannot insert into data in new table

Select table from Sql server and insert data to Mysql table

Insert Json data into temp table using SQL Server Json

Insert data into columns of Excel sheet from SQL Server table

Copy data from table and insert in different SQL Server database

Unable to insert data from the JSON in to the SQL server table

Insert data from text file into a table SQL Server

Insert Data into an existing SQL Server table

Insert Into XML Data into SQL Server Table

Batch insert to SQL Server table from DataTable using ODBC Connection

insert from linked server table in SQL server into local table

no response from page when trying to insert data in table in sql server using asp.net and c# . data didn't insert sql server table

Insert rows into SQL Server table from json

Update a local db table from remote SQL Server db table

How do you insert data from text file into SQL Server table using Python?

Using SSIS, how to insert new data from Excel sheet into my existing SQL Server table

How to Insert Data Field Table SQL Server from another SQL Server in different ip?

SQL Server to Oracle DB - Use a SQL Server create table script in Oracle DB

How to insert data in sql server table using user defined table types, and check duplicate data?

SQL Server : Insert into Relation Table

SQL Server error with ' ' insert into table

load data from sql server table and populate textboxes using dapper

SQL Server: Insert into table selecting from another table

SQL Server 2012 - Insert into linked server table using openquery