Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Partial load using SQL Select and Where Not Exists

I can't seem to figure out where I am going wrong with regards to writing a partial load statement, using a SQL Select from a SQL Server database, with a Where Not Exists clause.  Can anyone provide a good example?  Thanks.

6 Replies
marcus_sommer
Not applicable

Re: Partial load using SQL Select and Where Not Exists

Not sure, but I think there isn't anything what could be compared with exists because it will be only these sql-statement executed. Maybe you could set those load-statement which created the exists-matchingfield in the partial load, too.

- Marcus

Not applicable

Re: Partial load using SQL Select and Where Not Exists

Please share the sample code.

giakoum
Not applicable

Re: Partial load using SQL Select and Where Not Exists

Just a thought :

If the field you are using in your exists statement does not hold unique values, then only the first encountered value will be returned. Thus you will not get the desired result.

See here for more details : The exists issue

Not applicable

Re: Partial load using SQL Select and Where Not Exists

Thanks for the info everyone, but I'm not seeing the answer quite yet.  Maybe if I add a "template" version of my code, that will help better explain my goal/issue.  Hope this helps. Thanks.

=====================================

// this will execute upon a "normal/full" reload

// this will be ignored upon my partial reload later

MyExistingQVTable:

  SQL SELECT

  ID,

  SomeField

  from SomeTable    //a table from sql server

  ;

// I expected this to execute upon a partial reload and add applicable rows to my MyExistingQVTable table

//(applicable rows being those with IDs not already found in my MyExistingQVTable table

// but it doesn't like my syntax of my Where Not Exists clause

Add Only

  SQL SELECT

  ID,

  ID as ID_New 

  SomeField

  from SomeTable    //a table from sql server

  Where not Exists (ID_New, ID)

  ;

DROP Field ProductID_New;

=====================================

giakoum
Not applicable

Re: Partial load using SQL Select and Where Not Exists

I don't think that will work as not exists is not a SQL function, it is a QV function.

try a preceeding load :

load

     *

Where not Exists (ID_New, ID);

SQL SELECT

  ID,

  ID as ID_New

  SomeField

  from SomeTable    //a table from sql server

Not applicable

Re: Partial load using SQL Select and Where Not Exists

Thanks