2 Replies Latest reply: Jun 26, 2012 9:50 AM by Jose Tos RSS

    Incremental load date format problem

    Jose Tos

      Hi, I´m trying to do an incremental load but this is the problem:

       

      First of all, I get a date from the SQL that tells me the date of the last data we have, this field is FUltModif.

      After the first load I have a table with the initial data and this is Geo.QVD, so I get the max FUltModif and then I get it with peek() function.

       

      Tabla:

      LOAD Date(max(Fecha_Modif),'DD/MM/YYYY') AS Fecha_Max //I have to do a Date() function because I was getting a number instead a date.

      from $(Path_QVD)Geo.QVD

      (qvd);

       

      let vUltimaModif = peek('Fecha_Max',0,'Tabla'); //Debugging I can see that this returns me a date '12/12/2000'

       

      DROP Table Tabla;

       

      // First I load all the old data I have in my QVD

      Georeferenciacion:

      LOAD *

      From $(Path_QVD)Geo.QVD

      (qvd);

       

      // And I want to concatenate the new data, the data with modification dates bigger than my last modificate date from my QVD

      Concatenate

      LOAD

           Cliente

          ,DepartamentoCod as DepCod

          ,CiudadCod        as CiuCod

          ,BarrioCod as BarrioCod

          ,CPostal

          ,Date(FUltModif,'DD/MM/YYYY') as FUltModif

          ,Date(FUltModif,'DD/MM/YYYY') as Fecha_Modif

          ,SitViviendaCod;

      SQL select

           Cliente

           ,DepartamentoCod

           ,CiudadCod

           ,BarrioCod

           ,CPostal

           ,Convert(varchar,DataBaseTableX.FUltModif, 103) as FUltModif       // Convertion from varchar to Date DD/MM/YYYY

           ,SitViviendaCod

      from DataBaseTableX

      where FUltModif > #$(vUltimaModif)# 

      ;

       

      What I´m doing wrong?? It seems like the where clause is comparing anything,

      I suppose that is because they have different formats but I don´t know why.

       

      Help me please, thank you.

       

      Regards,

      Chema.