4 messages in com.mysql.lists.mysqlRE: Copy some datasets including the ...| From | Sent On | Attachments |
|---|---|---|
| Eidner, Fabian | 22 Nov 2006 04:45 | |
| Jerry Schwartz | 22 Nov 2006 06:53 | |
| Eidner, Fabian | 23 Nov 2006 03:46 | |
| Jerry Schwartz | 27 Nov 2006 08:17 |
| Subject: | RE: Copy some datasets including the foreign key constraints![]() |
|---|---|
| From: | Jerry Schwartz (jsch...@the-infoshop.com) |
| Date: | 11/22/2006 06:53:37 AM |
| List: | com.mysql.lists.mysql |
Do you know what your query looks like after variable substitution? That always helps me a lot. If you can't dump it to the screen because it breaks too much of your system, look into syslog(). That's what I use when debugging the heart of our online system, and it has helped me find missing single quotes and the like.
Regards,
Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
-----Original Message----- From: Eidner, Fabian [mailto:fabi...@sap.com] Sent: Wednesday, November 22, 2006 7:46 AM To: mys...@lists.mysql.com Subject: Copy some datasets including the foreign key constraints
Hello list, I'm pretty new here.
But i already got an problem. I'm working a while with mysql currently i'm trying to duplicate some entries in my tables. The problem is, i'm using foreign key constraints between those tables and i also would like to duplicate the childs.
So i got one big parent, these parent table has some child tables. All are contatenatet via the FK constraints. Currently i'm extracting the references by foot. So i do a SHOW TABLE STATUS FROM akron LIKE '$tablename'. After that i explode the information an so on. Very dirty stuff, a lot of code.
And now after all the hard work mysql throws me this when i try to insert a copy of a parent: Cannot add or update a child row: a foreign key constraint fails The childs do exist, but i think my sql syntax is wrong i use: "INSERT INTO $non_atomar[$i] VALUES ('',$values)" The key values are right, but i think sql need another syntax to be happy.
The other thing is, i can solve my problem in this dirty way, but i hope that there is an easyer way to do this. Did anyone know an easy way to copy a parent table and all his childs ? The only thing that changes are the keys.
Kind regards
Fabian Eidner
E stee...@brotherhood-of-steel.org
B-O-S website http://www.brotherhood-of-steel.org




