Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

DateDiff function to load data

Dear All,

We are using MSSQL as our data source, we could connect to the SQL server from QV.

We are now trying to load our data from the SQL server. we are using the following query in the Edit script to load data for the next 90 days, however we are getting error while we reload the script.:

SNAPSHOT:

LOAD snapshotdate,

          potentialid,

          amount,

          closingdate,

          Ceil(Month(closingdate)/3) as Quarter,

          "sales_stage" AS snap_salesstage;

    

SQL SELECT * FROM "vtiger_crm".dbo.snapshot

  //where (closingdate-snapshotdate <=90) and (closingdate>=snapshotdate);

   where DATEDIFF(DD,snapshotdate,<=90) and (closingdate>=snapshotdate);

3 Replies
ariel_klien
Specialist
Specialist

Hi,

What kind of Error?

Can you send us the Error?

BR

Ariel

Not applicable
Author

in qlikview write this

simply write your where condition with load statement

SNAPSHOT:

LOAD snapshotdate,

          potentialid,

          amount,

          closingdate,

          Ceil(Month(closingdate)/3) as Quarter,

          "sales_stage" AS snap_salesstage

//where (closingdate-snapshotdate <=90) and (closingdate>=snapshotdate);

   where DATEDIFF(DD,snapshotdate,<=90) and (closingdate>=snapshotdate);

    

SQL SELECT * FROM "vtiger_crm".dbo.snapshot ;

Not applicable
Author

We tired the above resolution and we are getting the following error:

Error in expression:

DATEDIFF is not a valid function

SNAPSHOT:

LOAD snapshotdate,

          potentialid,

          amount,

          closingdate,

          Ceil(Month(closingdate)/3) as Quarter,

          "sales_stage" AS snap_salesstage

          where DATEDIFF(DD,snapshotdate,closingdate)<=90