Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

OLEDB Read Failed Error

I have the following Script:

Screenshot 2017-08-20 17.50.15.png

When i  load the above script i get an OLEDB Read Failed error message.  What is wrong in the Script?

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

SQL Select

Branch,[Retail Pharmacy],[Script Number],

Count(Distinct [Script Number]) as Rx

from PharmaMarketAudit.dbo.tblDatawarehouseConsolodatedCleanStage

Group By

Branch,

[Retail Pharmacy],

[Script Number];

View solution in original post

13 Replies
antoniotiman
Master III
Master III

Hi Christopher,

[Script Number] field there is not in the Group By

Regards,

Antonio

sasiparupudi1
Master III
Master III

Try with a resident load than a preceeding load

Temp:

SQL Select Branch,

"Retail Pharmacy",

"Script Number"

From PharmaMarketAudit.dbo.tblDatawarehouseConsolodatedCleanStage;

Noconcatenate Load

Branch,

[Retail Pharmacy],

[Script Number]

Count(Distinct [Script Number]) as Rx

Resident Temp

Group By

Branch,

[Retail Pharmacy],

[Script Number];

Drop Table Temp;

Anonymous
Not applicable
Author

Hi Christopher,


Do not use aggregation directly while loading the data. Probably it should be the reason for you to get the error.


First load the data and then use resident load while doing aggregation. Sasidhar has given the script in this thread. It should work for you to resolve the issue.


-GDK

Anonymous
Not applicable
Author

Noted with thanks Antonio.  However the script takes forever to execute and i am having to force it to end

Anonymous
Not applicable
Author

Thank you Sasidhar.  After loading the temp table, the script takes forever to execute the resident load and i am having to force it to quit without ending the script execution

Anonymous
Not applicable
Author

Thanks Gowtham, please see my responses above

Anonymous
Not applicable
Author

I did a distinct SQL SELECT in the temp table load and a straight count in the resident load to reduce the amount of memory use

antoniotiman
Master III
Master III

Christopher,

move Group by from LOAD to Select

This should be faster..

SQL Select

Branch,[Retail Pharmacy],[Script Number],

Count(Distinct [Script Number]) as Rx

Group By

Branch,

[Retail Pharmacy],

[Script Number]

from PharmaMarketAudit.dbo.tblDatawarehouseConsolodatedCleanStage ;

However, if You Group By [Script Number] then Count(Distinct [Script Number]) is always 1.

Perhaps remove DISTINCT from Count or remove [Script Number] from Select Fields List and from Group By.

mayuresh_d
Partner - Creator
Partner - Creator

as per me here group by is issue....

Please remove group by and load ..then take resident and then aggr value. else aggr in sql script don't agg in preceding load.