Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying records from on DB to another DB
Message
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Copying records from on DB to another DB
Divers
Thread ID:
01641828
Message ID:
01641828
Vues:
55
I have a challenge of copying some records from two tables of one database to the two tables (of the same name) in another database. Here is why it is a challenge.

The table names are:
PM_CATEG - Categories which has a PK field PMCATEG_PK
PM_TASK - PM Tasks which has a PK TASK_NO (Identity) and PMCATEG_PK (set matching the PMCATEG_PK in PM_CATEG table).

Example:
PM_CATEG
CATEGORY     PMCATEG_PK
PUMP              10

PM_TASK
PMCATEG_PK               TASK DESCR    TASK_NO
10                      List of items       200
10                      Another list        201
10                      Another list        280
(Note that the TASK_NO is not always sequential because it could have been created at different time).

Now I need to copy the records from PM_CATEG and PM_TASK of one DB to another for CATEGORY = 'PUMP'

I would use the INSERT command but I have to dynamically INSERT into the PM_CATEG and then using a newly created PMCATEG_PK copy the PM_TASK.

Is this possible or I am better off creating a VFP PRG to do it?

TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform