Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what kind of values we can put into timestamo field in sql server and how?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post
What kind of values we can put into timestamp field of sql server?
How we can put this value from JDBC section of our application?

for example if we have a table with a timestamp field, what kind of values it can accept and how we can insert the value using for example a prepared statement.

should we treat it as long, timestamp, datetime,.... ?>


Thanks
 
David Buzatto
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

You can use the static method valueOf of the java.sql.Timestamp to create a Timestamp to insert in the database.



I�m not sure, but i think you can use a string to:


Bye!
[ July 13, 2007: Message edited by: David Buzatto ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, this is not what SQL Server's timestamp data type is for. If you want to store a date or time in SQL Server, use datetime. timestamp is used only for versioning rows - it acually stores a binary value usually used to represent the time the row was modified. If you want to use this data type in a JDBC applciation, treat it as binary data.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic