954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

mysqldump with insert set syntax

Hi,

I have two databases (live and staging). Extra columns have been added to various tables within the staging database by another developer while they were extending the websites functionality.

Now has come the time to put the new functionality live, which means taking the staging database schema, creating a new live database and inserting the existing live database data into the new database.

What I want to do is create a mysqldump, which uses the following syntax, so that values are matched to a specified field name, not a field order.

INSERT INTO `table_x` SET `field_a` = 'A', `field_b` = 'B', `field_c` = 'C';


I've tried the --complete-insert and --no-create-table-info, and cannot see any other option that might be relevant. Does anyone have any experience with doing this and can provide some insight?

Thanks for your time.

R.

blocblue
Posting Pro in Training
475 posts since Jan 2008
Reputation Points: 142
Solved Threads: 79
 

I think I've just answered my own question actually.

Using the --complete-insert option does give a field to value mapping. So this together with the -no-create-info option seemed to work.

Thanks anyway, and I hope this helps someone.

R.

blocblue
Posting Pro in Training
475 posts since Jan 2008
Reputation Points: 142
Solved Threads: 79
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: