Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incremental Load Error

hello dears

i have problem in Read Incremental Load

i writeThis Code

plz help me

--------------------------------------------------------------

let existsQvdFile=IsNull(QvdCreateTime('IncrementalLoad.qvd'));

if existsQvdFile=-1 then

  IncrementalLoad:

  LOAD PrimaryKey,

     FirstName,

     LastName,

     ModificationTime ;

  SQL SELECT *

  FROM AdventureWorksDW2012.dbo.IncrementalLoad;

  STORE IncrementalLoad into IncrementalLoad.qvd(qvd);

  drop table IncrementalLoad;

end if

Let ThisExecTime = date(Now( ),'YY/MM/DD' );

if existsQvdFile=0 then

  QV_Table:

  SQL SELECT

  PrimaryKey,

     FirstName,

     LastName,

     ModificationTime

     FROM AdventureWorksDW2012.dbo.IncrementalLoad

  WHERE ModificationTime >=$(LastExecTime)

  AND ModificationTime <$(ThisExecTime);

  Concatenate

  LOAD

  PrimaryKey,

     FirstName,

     LastName

     FROM IncrementalLoad.qvd(qvd)

  WHERE NOT EXISTS(PrimaryKey);

  Inner Join SQL SELECT PrimaryKey FROM AdventureWorksDW2012.dbo.IncrementalLoad;

  If ScriptErrorCount = 0 then

  STORE QV_Table INTO IncrementalLoad.qvd(qvd);

  Let LastExecTime = Date(ThisExecTime,'YY/MM/DD');

  End If

end if

--------------------------------------------------------------------------------------------------------------------

my error Is :

2600.png

My Data Look Like

2800.png

3 Replies
swuehl
MVP
MVP

use single quotes around your variable expansion in the WHERE clause when expanding text values:

WHERE ModificationTime >='$(LastExecTime)'

  AND ModificationTime <'$(ThisExecTime)';

You  can also try to use num() in your variable definitions to convert your variables to numbers.

Not applicable
Author

thank but get error

modificationTime is date (sql server)

ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Conversion failed when converting date and/or time from character string.

QV_Table:

  SQL SELECT

  PrimaryKey,

     FirstName,

     LastName,

     ModificationTime

     FROM AdventureWorksDW2012.dbo.IncrementalLoad

  WHERE ModificationTime >='15/08/14' and ModificationTime <='15/08/14'

3200.png

maxgro
MVP
MVP

I think this (3 is for dd/mm/yy)

WHERE convert(varchar(8), ModificationTime, 3) >='$(LastExecTime)'

  AND convert(varchar(8), ModificationTime, 3) <'$(ThisExecTime)';