• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

adding time stamp to date column

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application developed where the data submits to the below table on clicking submit button.

The table has below columns

create table X(
a number
b varchar
c date
)

This table is already created in production environment. I now have a requirement to update the records of column C by adding timestamp, so that the precision of any newly inserted records from now would be captured. There are no chances of changing the datatype for the column from date to timestamp.

Please let me know if this could be done.


 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add a new column then copy the data over. Then remove the original column.
 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Scott, thanks for your suggestion.

However, as i mentioned, we do not have any permissions to alter the column's datatype or add new column.

Also, I tried to update the timestamp value into the column C which is having date as datatype. I notice that the precision which was availed with timestamp value is lost.

So, is there any other way. Please advice

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eshwar,
Why aren't you allowed to change the table in any way if it doesn't meet the requirement?
 
Scott Selikoff
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused as to what you're asking then. You can't change a field to a timestamp, if your not allowed to change the field to timestamp. That's just not possible.

Granted, date types vary from system to system, so it may be dependent on your system. For example, in MySQL DATE refers to java.sql.Date while DATETIME and TIMESTAMP both refer to java.sql.Timestamp. Interestingly though, they are all subclasses of java.util.Date. In other words, there's a lot of options depending on what your doing.
 
reply
    Bookmark Topic Watch Topic
  • New Topic