Update sql table with date format include

Dear members,

I have a sql table, which include date type, need to update date from excel to the sql table, not sure which type I could set for the Parameters? I can only get datetime type variable, not sure how to get date type variable.

Thanks.

Hi @li.yu

You can pass the date as string as like this,

Select* from table where date = ‘10-12-2022’

Thanks

hi @prasath_S , thanks, date field is what I want to update.1

@li.yu yes you can set it as string and pass, think it will update in the SQL.

Please refer the link,

Thanks

1 Like

I set as string, when uploading, no error, but no data updated in sql for this date type filed.

@li.yu Try like this,

“Select * from table where date = 10-12-2022”

Removing the single quote from the date.

If it’s worked use with a variable,

“Select* from table where date =” + Saplastup

Thanks

Hi,

Create string variable of date in uipath

for example dateStr=‘10-12-2022’

Use this variable in update query like this

"update tableName set columnName="+"'"+dateStr+"'"+"where Id="+"'"+1+"'"

you can add any id according to ur scenario.

Hope it will work

1 Like

Hello,

May be you can check your datatype for the date column in datatable created is database. mostly use varchar as datatype.

1 Like

thanks all, the reason is I used changed all column to date type, actually no need, set as string can be inserted.

1 Like

@li.yu hope youe issue is resolved then ,please close the thread by marking the solution so it may be useful to others in the future.

Thanks