cancel
Showing results for 
Search instead for 
Did you mean: 

Updating the Database with datetime stamp

Former Member
0 Kudos

Hi all,

I have a scenario where in once sender JDBC channel polls the database , i need to update the table with current datetime stamp for a particular DATE field.

what will be the update syntax command that i need to add in the sender channel ?

Update Emp Set DATE = ? where EmmNo = 100;

Regards

Vinay P.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vinay,

In the databse, while creating the date field 'DATE', choose the data type for this as 'DATETIME'.

It will give you the required format.

-Supriya.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Vinay,

Assuming you are using SQL server databse, use the below query:

Update Emp Set DATE = GetDate() where EmmNo = 100;

-Supriya.

Former Member
0 Kudos

Hi Guys ,

The following query is working :

Update Emp Set DOJ = GetDate() where EmpNo = 1; O/p = Sep 1 201

Regarding adding Time as well , which function do i need to use

Also say for example , i need the Date time stamp format to be updated in the following format : dd.mm.yyyy hh:mm:ss , what will be the syntax

Regards

Vinay P.

Former Member
0 Kudos

Sorry for the wrong update ,

Syntax : Update Emp Set DOJ = GetDate() where EmpNo = 1 ; is returning the current date time stamp value along with milliseconds

In order to make sure that i get only the following format : dd.mm.yyyy hh:mm:ss , what changes do i need to make in the syntax

Regards

Vinay P.

Former Member
0 Kudos

Hi Vinay,

You can use the following command if the database that you are using is ORACLE

Update Emp Set DATE = SYSDATE where EmmNo = 100;

This should work for ORACLE Db. In case you are using a different Db, please let us know.

Regards, Gaurav.

former_member208856
Active Contributor
0 Kudos

use

UPDATE EMP Set Date = curdate() where Emmno = 100.

rajasekhar_reddy14
Active Contributor
0 Kudos

Have you defined any field in Data base to store date??

you can define one field in data base, you can make that defualt "SYSDATE" when even you update the data in table sysdate will be update in table by defult,you no need to update.

elase you have to do it manually.

Regards,

Raj