Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes what kind of values we can put into timestamo field in sql server and how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "what kind of values we can put into timestamo field in sql server and how?" Watch "what kind of values we can put into timestamo field in sql server and how?" New topic
Author

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

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
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

Joined: Jul 16, 2006
Posts: 9
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 ]

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." (Fowler)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
 
subject: what kind of values we can put into timestamo field in sql server and how?
 
Similar Threads
Hibernate: Default Binding of database field
SimpleDateformat
Recent Transaction Records
how to prevent multiple users overriding each other operations
Reading XML file to populate text fields