Simple Machines Community Forum

General Community => Scripting Help => Topic started by: skb on February 05, 2020, 11:50:10 PM

Title: Help with UPDATE TABLE
Post by: skb on February 05, 2020, 11:50:10 PM
I need to update a table into my new database from an older database. Inserting the old records should be fine, if the newer records also remain intact.
I've tried various permutations and combination with the UPDATE TABLE command but keep running into syntax errors, as I am a total nerd.

Can someone please guide me.
Title: Re: Help with UPDATE TABLE
Post by: d3vcho on February 06, 2020, 03:26:30 AM
Tell us how are you trying to do it, so we can tell you what's wrong.
Title: Re: Help with UPDATE TABLE
Post by: skb on February 06, 2020, 06:09:09 AM
Through PhPMyadmin on my Wamp local setup.

I finally got it with this command;

QuoteINSERT INTO dbxxx.smf_tablename SELECT * FROM dbyyy.smf_tablename;

But not before working around a Duplicate Entry for Primary Key error with this;

QuoteSET foreign_key_checks = 0;
TRUNCATE `tablename`;
SET foreign_key_checks = 1;