3 Replies Latest reply: Feb 3, 2012 7:53 AM by jmorate21 RSS

    Load multiple QVD with different fields into one single table

      Hello,

       

      I have a folder with multiple QVD which are generated daily. Each file's name is MYDATA_[year][month][day].qvd. Each file contains the same number of fields and each field has the same name. Each file contains just one row. Example:

       

      MYDATA_20120129.qvd

      Data: 20120129

      Field_A : Value_A

      Field_B : Value_B

      Field_C : Value_C

       

      I introduce a change on Jan 30th, so the files have now a new field

       

      MYDATA_20120130.qvd

      Data: 20120130

      Field_A : Value_A

      Field_B : Value_B

      Field_C : Value_C

      Field_D : Value_D

       

       

      So, when I try to load each file in a single QV, the Field_D cannot be found on each file, obviously, and the load fails.

       

      LOAD *

      FROM C:\MYDATA_*.qvd (qvd);

       

      I try to add the "WHERE EXISTS(Field_D)" unsuccessfully.

       

      I need to load files dated prior to January 30th with fields A, B, C and assigning default value 0 to field D; and load files dated after January 30th with fields A,B,C and D into one single table.

       

      Anyone has an idea?

      Thank you!