Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Tags (1)
3 Replies
MVP
MVP

Re: Incremental Load Error

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

Re: Incremental Load Error

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

MVP
MVP

Re: Incremental Load Error

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

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

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

Community Browser