Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
How with a SQL connection, recover data that has not been repatriated since the last connection and are stored in a QVD file (Ecritures.qvd)?
I can not use the $ (Maxpiece) variable with the SQL SELECT statement with the Where condition.
You will find below my script which does not accept the variable
thank you for your help
========================
LOAD
Max(EC_No) as Maxpiece,
FROM
(qvd);
ODBC CONNECT TO BASE_LOCAL2 (XUserId is bbbRdYRNJbaMXUVMXTcB, XPassword is vvVYaRdNrLacWXJObA);
Ecritures:
SQL SELECT *
FROM ACHATS.dbo."ECRITURES"
Where (EC_No > $(Maxpiece));
============================================
Hi Ruben
Thank you for your answer, it was almost correct but it did not work. I found in the meantime how to do it and here is the solution.
LOAD
Max(EC_No) as MaxNo,
FROM
(qvd);
Let Maxpiece = peek(‘MaxNo’) ;
ODBC CONNECT TO BASE_LOCAL2 (XUserId is bbbRdYRNJbaMXUVMXTcB, XPassword is vvVYaRdNrLacWXJObA);
Ecritures:
SQL SELECT *
FROM ACHATS.dbo."ECRITURES"
Where (EC_No > $(Maxpiece));
Hi Olivier, in that code Maxpiece is a field, not a variable, you can create a variable of that field value:
LET vMaxpiece = Peek('Maxpiece',0);
And use this variable in where:
Where (EC_No > $(vMaxpiece));
Hi Ruben
Thank you for your answer, it was almost correct but it did not work. I found in the meantime how to do it and here is the solution.
LOAD
Max(EC_No) as MaxNo,
FROM
(qvd);
Let Maxpiece = peek(‘MaxNo’) ;
ODBC CONNECT TO BASE_LOCAL2 (XUserId is bbbRdYRNJbaMXUVMXTcB, XPassword is vvVYaRdNrLacWXJObA);
Ecritures:
SQL SELECT *
FROM ACHATS.dbo."ECRITURES"
Where (EC_No > $(Maxpiece));
Your original post calls that field 'Maxpiece', not 'MaxNo'