How to pass date as a variable in sql query execution in workflow

Hi,

I need urgent help on passing date as a variable in below sql query.

While we are writing it as date variable it is displaying error as “No Mapping exists from object type GenericValue to a known managed provider native type”
Example:
"where

– c.containername = ‘17505’

AND convert(date,HML.TxnDate) =’&TxnDate.ToString()&’

– year(HML.TxnDate) = 2018 – and month(HML.TxnDate) = 1

– and IAh.cscProductName is not null

and MLI.DefaultLot = '2018157531'

and TagName = ‘RMQtyTag’"

Thanks,
Mounika

@Lucas.Pimenta

Hi Lucas,

Could you please help with this issue.

Thanks,
Mounika

Hello!

Could you please send a screenshot of your Query inside the UiPath Studio?

And aren’t you missing a " there?

Try this:

[…]
AND convert(date,HML.TxnDate) =’" & TxnDate.ToString()& "’
[…]

Regards,

1 Like

@Lucas.Pimenta Thanks for the reply.

If we use " (Double Quote), it is throwing an error as(String constants must end with a double quote).

Created the TxnDate variable type as ‘DateTime’.

Attached the query.

Please suggest us.

Thanks,
Mounika

Hello,

The double quote is mandatory so you can assign the variable through the String.

It’s possible to share the workflow (or the workflow just with the string) so I can check it out?

Regards,

@Lucas.Pimenta attached the workflow.

Thank You,
Mounika
CamstarDBsap.zip (1.4 MB)

Thanks for your help.

Resolved issue, by removing quotes for variable in query.

Regards,
Mounika

1 Like

Glad you solved :slight_smile:

Regards,

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