davidvilson
asked on
move table1 contents to table2 from different databases
Dear experts,
I got a request in my office today ..
I need to move contents from table1 (from database1) to table2(database2)..
Could any one please tell me the sql/plsql/cursor code that will do this job of moving records from one table to other from different databases..
I got a request in my office today ..
I need to move contents from table1 (from database1) to table2(database2)..
Could any one please tell me the sql/plsql/cursor code that will do this job of moving records from one table to other from different databases..
ASKER
But why this if@rowcount > 0, truncate table table1 ????
ASKER
Also, since im doing this job every day as schedule, table1 records have to be appended to table2.. It should not simply add or over write in table2..
ASKER
Records should be appended to the existing table2. does the above query appends?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sry, what an idiot Iam
yes, you need to provide the qualified name for that (databasename.dbo.tableNam
INSERT INTO database1.dbo.Table2
SELECT * FROM database2.dbo.Table1
IF @@ROWCOUNT > 0
TRUNCATE TABLE Table1