How to update current system date & time into Database

I want to update the current system date& time into SQL Database, but getting below error, can anyone please advise on this.

Execute Non Query: Conversion failed when converting date and/or time from character string.

Below is my Query

Below are the Parameters


Once hard code the values into Sql Query and check it once whether its working or not.

Hello @nm09011985,

Check the datatype & format of ACTIVITYSTARTDATE and ACTIVITYENDDATE in the Database.


1 Like

Make sure your character string is of the format yyyyMMdd. I recommend this, since it is the universal ISO format accepted for string-to-date conversions in SQL. This will work regardless of the locale of the server.

1 Like

just never use Datetime as string unless you need to, in your case looks like your database expects that column to be of type datetime.

If you want to update current system date and time into database, you can just direct write the System.DateTime.Now.ToString(“DDMMYYY hh:tt:ss”) into the execute query activity within the below parameter:
‘“+System.DateTime.Now.ToString(“DDMMYYY hh:tt:ss”)+”’

Hope, it will works.

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