Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I merge two tables together?

Status
Not open for further replies.

pwel

Programmer
Aug 18, 1999
79
GB
I have two sql databases on the same server, one is a copy of the other(the live db)!

I have been making ammendments to a table in the copied db and now wish to merge it back into the live db table.

I need to leave any new information in the live table intact, but replace the old information with the ammended information from the copy!!!!

Can I do this?

I have tried to DTS the table back into the live DB using the import data function, with no luck, it deletes the new information from the live copy?

Please help.

Paul Welding.
 
CREATE TABLE TEMP AS SELECT * FROM ORG_TABLE

DROP ORIG_TABLE

CREATE ORG_TABLE AS (.....Use the table script for the new version).

INSERT INTO ORG_TABLE SELECT * FROM TEMP (IF THE NUMBER OF COLUMNS HAVE NOT CHANGED)

INSERT INTO ORG_TABLE (COL1,COL2..THE OLD COLS) SELECT * FROM TEMP

Even if you changed a datatype (well from number to char) it will work...



Cal


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top