on 09-13-2010 9:31 AM
Hi,
is there a way to convert a database column of type date into timestamp?
It does not work with the SqlStudio. A Date can only be converted into varchar. And I get an error with the statement 'alter table xytab modify xycol timestamp', because of an error (Invalid date format:ISO).
Can anyone please help me?
Many thanks in advance, Oliver.
Hi,
a conversion can be done using the function TIMESTAMP (a,b), where a has to be the date-value and b has to be some time-value.
There is no implicit conversion during alter table modify from date to timestamp.
Therefore you will have to
rename date-column to xyz
alter table add wanted-column-name TIMESTAMP
update wanted-column-name = timestamp(xyz, <some time-value you like>)
alter table drop xyz
And as you are using ISO-time-format you should keep in mind, that the used timevalue has to be specified according to this:
'HH:MM:SS' example: '14:30:08'
Good luck,
Elke
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's it.
Many many thanks for the quick response.
Bye Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.