Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
chematos
Specialist II
Specialist II

Incremental load date format problem

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.

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

I think SQL server date format should be YYYY/MM/DD in order to understand and compare.

View solution in original post

2 Replies
giakoum
Partner - Master II
Partner - Master II

I think SQL server date format should be YYYY/MM/DD in order to understand and compare.

chematos
Specialist II
Specialist II
Author

This little things are what makes me crazy sometimes !

May be they should change the format for 103 code...

103select convert(varchar, getdate(), 103)30/12/2006

If someone follows this thread to use it, they will need to eliminate the '#' symbols of

#$(vUltimaModif)#

Thank´s Ioannis!!