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:[EMAIL PROTECTED]
> Sent: Wednesday, November 22, 2006 7:46 AM
> To: mysql@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  [EMAIL PROTECTED]
>
> B-O-S website  http://www.brotherhood-of-steel.org
>
>
>




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to