Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Append Oracle data base into a SQL 2005 table

Author  Topic 

korssane
Posting Yak Master

104 Posts

Posted - 2009-04-02 : 09:32:04
Hi Guys,
i have created a query that pull data from an oracle database successfully using a linked server.My question is :
- IS there a way to append daily data to the exsisting table..
cuz every time i am ruinning the same query it is like doubling the same recods in the SQL 2005 Table.
FYI :I am running sql 2005 express edition.
thanks for the help

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2009-04-02 : 10:52:11
You can truncate the SQL table before doing the "append". The append could work if you could determine what the new and/or updated Oracle records are and only bring that subset across. Then you'd need to insert the new data and update any existing on SQL. It may be easier to simply truncate the SQL data first and load all from Oracle - but that also will be dependent on the volume of data coming across.

Terry

-- Procrastinate now!
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-04-02 : 11:03:14
INSERT INTO sqlserverTable (a, b,c)
SELECT a,b,c
FROM [linked].dbo.OracleTable
WHERE dateCol=getdate()-1
Go to Top of Page

korssane
Posting Yak Master

104 Posts

Posted - 2009-04-02 : 13:00:07
thanks guys ,

the new records are always the yesterday's ones i.e means yesterday's date which is a filed in my table.
Another question for you experts :
is it possible to tell me how can i run this query daily..(sq l 2005 express edition has schedule job task limitation) ?

I really appreciate your help.
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-04-03 : 04:38:00
Save the query as a procedure and run it outside of SQL Server.
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=120497
Go to Top of Page
   

- Advertisement -