RegularNormalDayGuy
RegularNormalDayGuy

Reputation: 735

How to insert data into a db link table

I am working on a sql server script in order to write to an oracle table.

I wrote a procedure that gets my data and stores it into a temporary table. Now, I'm not sure what to do to insert that data into a table on my dblink to oracle db. I tried a couple things, but by dblink_table is not recognized as an object.

INSERT INTO dblink_table@dblink_name AS SELECT * FROM #temp;

I've tested my dblink connection and it works fine

Upvotes: 0

Views: 5200

Answers (1)

Littlefoot
Littlefoot

Reputation: 142713

Syntax you used (actually, posted) looks wrong; as seems to be superfluous.

INSERT INTO dblink_table@dblink_name SELECT * FROM #temp;

Though, I prefer & I'd suggest you to always mention all columns involved, e.g.

INSERT INTO dblink_table@dblink_name
  (id, name, job, sal)
  SELECT id, name, job sal
  FROM #temp;

Upvotes: 2

Related Questions