Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
Please share the sample code.
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
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;
=====================================
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
Thanks