Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

shayraber
Contributor

SQL Server query fails

hi all,

i have an SQL Server DB with two table i want to extract from.

both are with the same structure.

created an ODBC connection and i'm able to extract data using sql select statements.

thw issue raised when i switched the query to be incremental based on an update filed at the table (datetime type).

the first table works as expected. the second one, which has the exact same structure DON'T...

the error i'm getting is (in blue and bold there is the variable holding the last update date):

.....

07/02/2017 21:55:23: 0025  service_req_DELTA:

07/02/2017 21:55:23: 0026  LOAD *

07/02/2017 21:55:24: 0027  SQL

07/02/2017 21:55:24: 0028  SELECT update_time

07/02/2017 21:55:24: 0029  FROM SysAid.dbo."service_req"

07/02/2017 21:55:24: 0030  where update_time >= '01/02/2017 00:00:00'

07/02/2017 21:55:25:       1 fields found: update_time, 4,351 lines fetched

07/02/2017 21:55:27: 0031  STORE * from service_req_DELTA into service_req_DELTA.qvd (qvd)

07/02/2017 21:55:28: 0034  UPDATE_TIMES2:

07/02/2017 21:55:28: 0035  LOAD 'service_req' as TABLE_NAME,

07/02/2017 21:55:28: 0036   Floor(Max(update_time)) as LAST_UPDATE

07/02/2017 21:55:28: 0037  Resident service_req_DELTA

07/02/2017 21:55:29:       2 fields found: TABLE_NAME, LAST_UPDATE, 1 lines fetched

07/02/2017 21:55:31: 0038  DROP Table service_req_DELTA

07/02/2017 21:55:34: 0040  service_req_history_DELTA:

07/02/2017 21:55:34: 0041  LOAD *

07/02/2017 21:55:35: 0042  SQL

07/02/2017 21:55:35: 0043  SELECT *

07/02/2017 21:55:35: 0044  FROM SysAid.dbo."service_req_history"

07/02/2017 21:55:35: 0045  where update_time >= '01/02/2017 00:00:00'

07/02/2017 21:55:37:       Error: SQL##f - SqlState: S1000, ErrorCode: 0, ErrorMsg: [Microsoft][ODBC SQL Server Driver]Protocol error in TDS stream

07/02/2017 21:55:55: 0045  EXIT Script

why does a where clause works at one table and doesn't work at the other one? please assist

2 Replies
m_schindler
Contributor II

Re: SQL Server query fails

Hello!

I dont know whats causing this but according to this thread, you should try updating your ODBC-Driver or use OLEDB:Protocol Error in TDS Stream

best regards

Highlighted

Re: SQL Server query fails