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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.