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: 
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 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
Author

Please share the sample code.

giakoum
Partner - Master II
Partner - Master II

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
Author

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
Partner - Master II
Partner - Master II

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
Author

Thanks