3

I want to export data from a sql table, but I dont want the primary key to be exported.

The reason is that I have data on my localhost that needs to be inserted in a remote database (remote and local db have the same structure). But on the remote db, the table already has data, and they will be primary key conflicts if I try to add the data from my localhost.

This question has somehow been treated here before: table-without-dumping-the-primary-key.

I used this method in the past, but it's annoying to have to create a new table to make the transfer...

It surprises me that I can't export data from a table while omitting a column, in this case, the primary key column. Been looking the mysql documentation but it wasn't helpful...

Any idea?

Community
  • 1
  • 1
Pierre
  • 4,607
  • 12
  • 48
  • 71
  • i think your question is a bit not clear, if both table are using same set of schema, how you can do the insertion without primary key ? UNLESS you are refer auto increment as primary key, which is not the same synonym – ajreal Jun 17 '11 at 11:40
  • Yes sorry, I refer to the auto-increment – Pierre Jun 17 '11 at 12:04
  • 1
    the closest way is in the above answer - http://stackoverflow.com/questions/1018669/mysqldump-table-without-dumping-the-primary-key/1018765#1018765 – ajreal Jun 17 '11 at 12:14

1 Answers1

2

Can you create a VIEW without the primary key, and then export VIEW DATA?

UltraCommit
  • 1,966
  • 5
  • 38
  • 58