>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
Yes, this will work. But!!!! the first field will get the value from the first array element, the 2nd field from the 2nd array element and so on.
you just have to ensure that the order of field of the table you are inserting into is the same as the table you are inserting from.
Regards,
Abdul Ahad