Sql case statement with Excel as data source - IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

Hi All, I get the following issue while trying to execute sql case statement with excel as data source. - IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

My query is
“select
A.[Id], Case When B.[sId] Is NULL Then ‘New’ Else ‘Existing’ End
from [Current$] A
left Join [Previous$] B On A.[Id] = B.[Id]”

I am just checking if a value of coulmn1 in sheet 1 is available in Column1 of sheet2.

P.S: My production data has 10 columns in each sheet and about 500k records to compare. Existing Vlookup is very slow for business.

Please suggest.

1 Like

Hi @prasanthpulipati

Welcome to the community!!!

Can you change the query as follows and see what happens

“select
A.[Id], Case When B.[sId] Is NULL Then ‘New’ Else ‘Existing’ End AS AvailableStatus
from [Current$] A
left Join [Previous$] B On A.[Id] = B.[Id]”

What i did is just gave a column name to the case statement. Try it out and see whether you still get the error

Hey Thank you for your response !

I did try that, still getting the same issue.

Ok… so where are you running this script in? In your excel file? I suppose your excel is getting data from a sql database? If so you can directly run the query from uipath database activities

I have connected to excel using oledb conncetion using Uipath Database activity. I am trying to execute the select query in uipath.

@prasanthpulipati

This link is from another site, out of UiPath. But thought of sharing it because this error doesn’t seems to be from UiPath Studio, but from outside of it…

Try out the stuff recommended in the solution there, it might help

Hi Thanks for your time, I have fixed the issue.

We cannot use SQL Case statement while trying to query excel data in Uipath.
Instead Iif(expression,value1,value2) can be used.

“select
A.[sId] as [sID], A.[Screen] as [Screen], A.[Identifier] as [Identifier],
Iif(B.[sId] is Null,‘New’,‘Existing’) as [Status]
from [Current$] A
left Join [Previous$] B On A.[sId] = B.[sId]”

This works !

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.