PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Copy rows from one table into another table.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Copy rows from one table into another table.

Réponse
 
LinkBack Outils de la discussion
Vieux 05/10/2007, 21h33   #1
Dan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Copy rows from one table into another table.

Hi, I have two different database with the same schema.

I want to save some rows from one table of Database A.

Then insert these rows into the corresponding table in Database B.
What is the best way to do that?

Not sure if I can use mysqldump since mysqldump always try to drop the
table before you insert
the rows. But I need to keep the table in Database B. Thanks!

  Réponse avec citation
Vieux 05/10/2007, 23h47   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Copy rows from one table into another table.

Dan wrote:
> Hi, I have two different database with the same schema.
>
> I want to save some rows from one table of Database A.
>
> Then insert these rows into the corresponding table in Database B.
> What is the best way to do that?
>
> Not sure if I can use mysqldump since mysqldump always try to drop the
> table before you insert
> the rows. But I need to keep the table in Database B. Thanks!


mysqldump doesn't always try to drop the table. There are options on
mysqldump that enable you to produce only the INSERT statements and nothing
else.

To find the details search for mysqldump in the manual (you know that book
that other people go to when they need an answer to a question like this).


  Réponse avec citation
Vieux 06/10/2007, 11h35   #3
Séverin Richard
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Copy rows from one table into another table.

Dan wrote:
> Hi, I have two different database with the same schema.
>
> I want to save some rows from one table of Database A.
>
> Then insert these rows into the corresponding table in Database B.
> What is the best way to do that?
>
> Not sure if I can use mysqldump since mysqldump always try to drop the
> table before you insert
> the rows. But I need to keep the table in Database B. Thanks!
>


mysql5:

insert [ignore] into databaseB (

select * from databaseA

)


then, you have to deal with keys if some records are alrerady present in
databaseB...
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h57.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10075 seconds with 11 queries