Thursday, March 29, 2012

Copy just new rows

Hi,
I need to copy just the new rows from a Oracle DB to a MS-SQL table. I
created a DTS and I can get the information with no problems the issues is
that I only want to insert the new rows or records created.
Any tipsHow do you expect to define "new rows"?
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"julio delgado" <jdelgado89@.hotmail.com> wrote in message
news:u5z3eMiLFHA.2120@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I need to copy just the new rows from a Oracle DB to a MS-SQL table. I
> created a DTS and I can get the information with no problems the issues is
> that I only want to insert the new rows or records created.
> Any tips
>|||If you're talking about rows with keys that do not exist in the target, you
can use a linked server as follows:
INSERT INTO Target(column_list)
SELECT <column_list> FROM Source AS S
WHERE NOT EXISTS
(SELECT * FROM Target AS T
WHERE T.key = S.key)
Just specify instead of source or target (depending on where you're
connected to) the full four part name (server.db.owner.object).
BG, SQL Server MVP
www.SolidQualityLearning.com
"julio delgado" <jdelgado89@.hotmail.com> wrote in message
news:u5z3eMiLFHA.2120@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I need to copy just the new rows from a Oracle DB to a MS-SQL table. I
> created a DTS and I can get the information with no problems the issues is
> that I only want to insert the new rows or records created.
> Any tips
>|||Thanks
"Itzik Ben-Gan" <itzik@.REMOVETHIS.SolidQualityLearning.com> wrote in message
news:O%23M548iLFHA.1392@.TK2MSFTNGP10.phx.gbl...
> If you're talking about rows with keys that do not exist in the target,
you
> can use a linked server as follows:
> INSERT INTO Target(column_list)
> SELECT <column_list> FROM Source AS S
> WHERE NOT EXISTS
> (SELECT * FROM Target AS T
> WHERE T.key = S.key)
> Just specify instead of source or target (depending on where you're
> connected to) the full four part name (server.db.owner.object).
> --
> BG, SQL Server MVP
> www.SolidQualityLearning.com
>
> "julio delgado" <jdelgado89@.hotmail.com> wrote in message
> news:u5z3eMiLFHA.2120@.TK2MSFTNGP10.phx.gbl...
is
>sqlsql

No comments:

Post a Comment