Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
INSERT INTO and SELECT
I am convering a DB/2 Query Manager application. The application used the following code:
INSERT INTO PJL.HELTH_TMP
(DEDTYPE, MNPD, NAME, PRSNID, UNIT, DIV, DEPT, SUBDEPT,
EECLASCD, PRIORADJ, SSNO, SORTKEY, FAMSINGL, FRFAMSNG, DEDAMNT)
SELECT A.DEDTYPE, MNPD, NAME, PRSNID, UNIT, DIV, DEPT, SUBDEPT,
EECLASCD, PRIORADJ, A.SSNO, A.SORTKEY, FAMSINGL, FRFAMSNG, DEDAMNT)
FROM PJL.HELTHINS A
WHERE A.SSNO NOT IN
(SELECT B.SSNO
FROM PJL.HELTH_PRIORS_TMP B)
VFP 5.0 does not appear to support using a SELECT statment as an argument to the INSERT INTO statement. So I was thinking of trying this:
SELECT a.dedtype, mnpd, name, prsnid, unit, div, dept, subdept,;
eeclascd, prioradj, a.ssno, a.sortkey, famsingl, frfamsng, dedamnt,;
termcode, paidthru, addcode, adjamt, adjmonth, efctdate,;
a.user_comment;
FROM helthins_view a
WHERE a.ssno NOT IN (SELECT b.ssno ;
FROM helth_priors_tmp_view b);
INTO ARRAY aIns_Helth_Others
IF _TALLY > 0
INSERT INTO helth_tmp_view FROM ARRAY aIns_Helth_Others
ENDIF
My question is this: Will this work?! Will the insert into from array work wihout having to specify the field names? If this won't work, what is the alternative?
Jeff Rusch
UW-Madison
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement