View previous topic :: View next topic
|
Author |
Message |
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
Hi All,
I had one question, Can i convert the DATE datatype in DB2 to TIMESTAMP datatype, by making use of some function?
Early response would be appreciated.
Regards |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
mbr_raja
New User
Joined: 15 Nov 2004 Posts: 26 Location: Chennai, India
|
|
|
|
You can try to use the function Timestamp to convert given date into timestamp format.
TIMESTAMP (START_DATE, START_TIME)
for ex: TIMESTAMP('2007-09-28',' ')
the output will be timestamp format as 2007-09-28-00.00.00.000000 |
|
Back to top |
|
|
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
Hello Murmohk,
I tried TIMESTAMP_ISO function but i guess we might have previous version of DB2 installed, i am getting the below error:
DSNT408I SQLCODE = -440, ERROR: NO FUNCTION BY THE NAME TIMESTAMP_ISO HAVING COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH
below is the SQL i am using
SELECT * FROM TABLE
WHERE UPDATE_TIMESTAMP >
TIMESTAMP_ISO('2007-09-9');
Do you have any idea about this ?
mbr_raja
i tried your solution it is giving me below error:
SELECT * FROM TABLE
WHERE UPDATE_TIMESTAMP >
TIMESTAMP('2007-09-18','-00.00.00.000000');
DSNT408I SQLCODE = -180, ERROR: THE DATE, TIME, OR TIMESTAMP VALUE *N IS INVALID
Could you please share the SQL with me which you executed? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
You could use
Code: |
where update_timestamp > '2007-09-18-
00.00.00.000000' |
or the slightly less efficient
Code: |
where date(update_timestamp) > '2007-09-18' |
|
|
Back to top |
|
|
|