Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
baarathi
Creator III
Creator III

Increamental Load ODBC connected (sql data)

LastUpdatedDate:

           Load

               max(Date("TDate")) as MaxDate;


Let varLastExec = Date(Peek('MaxDate', 0, 'LastUpdatedDate'));

Let varThisExec = Date(Now());


M:

LOAD

    TDate,

    "ANO",

    BILL,

    PAY,

    "SDATE",

    "DNO",

     ADJ,

    COM,

    Cheq,

    "mk",

    "user",

    tkey,

    place,

    "icode",

    pkey;

Concatenate

     Load TDate,

    "ANO",

    BILL,

    PAY,

    "SDATE",

    "DNO",

     ADJ,

    COM,

    Cheq,

    "mk",

    "user",

    tkey,

    place,

    "icode",

    pkey from lib://QVDs/xyz.qvd

     where not Exists(thekey);

inner join

load tkey;

sql select tkey from PAN.T;


if ('$(ScriptErrorCount)') = 0 then

Store M into [lib://QVDs/temp.qvd](qvd);

Let varLastExec = '$(varThisExec)';

endif

    


SQL SELECT

    "TDate",

    "ANO",

    BILL,

    PAY,

    "SDATE",

    "DNO",

     ADJ,

    COM,

    Cheq,

    "mk",

    "user",

    tkey,

    place,

    "icode",

    pkey

FROM PAN.T

where date(TDate) <= #'$varLastExec'#;


I was trying for increamental load, but there is an error occured while script is loaded, Is the above script correct to perform increamental load ?

19 Replies
baarathi
Creator III
Creator III
Author

I have rectified that, It is showing the same error

baarathi
Creator III
Creator III
Author

Thank You, I'll check order of tables. But in link you have given it is for excel data, can i have something similiar for sql data?

big_dreams
Creator III
Creator III

Hi,

If possible, can you post your qvf and qvd...

Regards

baarathi
Creator III
Creator III
Author

Can I send the script in word file. Anyways sending the .qvf file won't execute since it is ODBC connected with my server

big_dreams
Creator III
Creator III

ok np..

but explain what issue you are still facing??

like data is not loading or getting error or anything so that I can help you in more better way to solve it..

Regards

baarathi
Creator III
Creator III
Author

Ya sure I'll say it one by one. 1st error I'm facing is

SQL select * from POM.T

where date(TDate) <=  #('$(varLastExec)')#;

Error Displayed is :

Started loading data

Connecting to Alocal Connected

The following error occurred:

Connector reply error: SQL##f - SqlState: 37000, ErrorCode: 4294967165, ErrorMsg: [Sybase][ODBC Driver][SQL Anywhere]Syntax error near '#' on line 20

The error occurred here:

?

big_dreams
Creator III
Creator III

It suggest SQL error.

What I understand from this You are combining qlik script (Syntax) with sql script

Try like

Load * where date(TDate) <= '$(varLastExec)';

SQL select * from POM.T;

Regards

baarathi
Creator III
Creator III
Author

But can I use Qlik script variable inside a sql statement? Because I want to limit the data getting select from sql itself, instead of limiting it in the load.

beck_bakytbek
Master
Master

the procedure is the same, you should only change your table from sql

baarathi
Creator III
Creator III
Author

Max Payne, Thanks for your support i have solved that issue