Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Where Statement Failed in OLEDB - ErrorMsg: Operand type clash: date is incompatible with int

Hi,

I am trying to get data from SQL table which fills t-1. days' datas inside. For example, in 5th Dec. i am getting 4th Dec data. And in 6th Dec. i am only getting 5th data.

I want to collect these datas inside qlikview and look like this:

Header 1Header 2
2014-12-031000000
2014-12-04234545

After initial load from Sql table, i erase query and create 3 sheets that contains queries in Qlikview.

in QV:

1- Initial Load Page:

//log_rapor:

//SQL SELECT *

//FROM SQL.dbo."Logs_T_1";

//

//Store log_rapor into qvd\Lograpor.qvd(qvd);

//Drop Table log_rapor;

2- Load Main QVD Page:

Main_log_rapor1:

LOAD

     Insert_date,

    scenario_id,

     label,

     action,

     Adet

    

FROM

[qvd\Lograpor.qvd]

(qvd);

TMP_MaxDate: 

LOAD Max(Insert_date) as Max_date 

FROM [qvd\Lograpor.qvd]

(qvd);

//LET vUpdateDate = Peek('Max_date');

LET vUpdateDate = Date(Peek('Max_date'),'YYYY-MM-DD');

DROP Table TMP_MaxDate; 

3- Incremental Load Page:

OLEDB CONNECT TO (.........)

Incremental:

NoConcatenate

SQL SELECT Insert_date,

     scenario_id,

     label,

     action,

     Adet

FROM SQL.dbo."Logs_T_1"

WHERE Insert_date > $(vUpdateDate);

4-Update Main QVD Page:

Concatenate

LOAD

     Insert_date,

     scenario_id,

     label,

     action,

     Adet

FROM

[qvd\Lograpor.qvd]

(qvd);

STORE Incremental into [qvd\Lograpor.qvd](qvd);

drop table Incremental;

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

I am getting error like this:

ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Operand type clash: date is incompatible with int

Incremental:

NoConcatenate

SQL SELECT Insert_date,

     scenario_id,

     label,

     action,

     Adet

FROM SQL.dbo."Logs_T_1"

WHERE Insert_date > 2014-12-04

Where the error can occur? I have been trying from yesterday, bu couln't figured out.

Can anyone help me on this?

Thanks in advance.

Ozan.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

May be like:

Let vUpdateDate=Date(Today()-1, 'YYYY-MM-DD')

and then

....

WHERE Insert_date > '$(vUpdateDate)';          

View solution in original post

4 Replies
tresesco
MVP
MVP

Try enclosing the date within quotes like:

WHERE Insert_date > '2014-12-04';                    // assuming the date format here is similar to the one in database

Not applicable
Author

Tresesco, thanks for the help.

The query is getting last day now when writing WHERE Insert_date > '2014-12-04';  // i didnt get any errors. 

But is it possible use like WHERE Insert_date > $(vUpdateDate)?

I guess that there occurs a problem when while using vUpdateDate. How can I get the last day automatically?

Thanks.

tresesco
MVP
MVP

May be like:

Let vUpdateDate=Date(Today()-1, 'YYYY-MM-DD')

and then

....

WHERE Insert_date > '$(vUpdateDate)';          

Not applicable
Author

Thanks Tresco,

i used

WHERE Insert_date > '$(vUpdateDate)';  instead of WHERE Insert_date > $(vUpdateDate);

and

LET vUpdateDate = Date(Max_date, 'YYYY-MM-DD');

it worked.