Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Unable to reload QV when writing SQL case statement.

Hi All,

Here I am Unable to reload QV when writing SQL case statement, where as if I load without that case statement, it runs successfully. But if we put that case statement and load it says connection OLE DB error and there after that case. I am sure I have connected thru the correct data source but unable to run. Need help.

SELECT  OU_TourCode,

case when charindex('D',substring(OU_TourCode,1,4)) > 0 then '' else OU_TourCode end as [OU_TourCode],

case when charindex('8',substring(OU_TourCode,5,8)) > 0 then '' else OU_TourCode end as [OU_TourCode],

case when charindex('8',substring(OU_TourCode,5,len(OU_TourCode))) > 0 then '' else OU_TourCode end as [OU_TourCode]

FROM         dbo.*********_history with (nolock)

where  1=1

condition......*******

Please help.

Kindest Regards

Shubham Kumar

2 Replies
erichshiino
Partner - Master
Partner - Master

Hi, Shubham

Your query returns the fields with the same name (OU_TourCode) a few times.

This is fine on SQL, but QV will not accept it, because the field name is very important to the associative logic.

If you need the query like this, you need to at least rename the fields.

Hope this helps,

Erich

Anonymous
Not applicable
Author

Thank you Shiino,

This solution provided by you have worked

Thanks & Regards

Shubham Kumar