This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Help with SQLServer Timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Help with SQLServer Timestamp" Watch "Help with SQLServer Timestamp" New topic
Author

Help with SQLServer Timestamp

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi, I created a timestamp field. I'm using SQLServer 2000 but when I INSERT a record, the timestamp field value looks like this...


0x000000000000045E


Why is it like that? It's not quite what I expected... Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

A Transact-SQL timestamp != an ANSI SQL-92 timestamp. If its a SQL style timestamp you are after use a datetime data type. A T-SQL timestamp are just auto generated binary numbers guarenteed to be unique in the context of a database and are typically used for versioning, not storing dates.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
so if I use datetime, will I need to input data implicitly (through code) or even when I supply data, it would get the current time for me?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

datetime is just a data type for storing dates. How you put the date in there is up to you. You could get the date in your application code or you could use SQL Server's current_timestamp function.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with SQLServer Timestamp
 
Similar Threads
truncation errors storing a Date in MySQL table
ClassCaseException
how i can create a TimeStamp from a number like: 1183450890250, or how insert it ?
sql Date, and getting Primary Key!
Help......Writer BLOB from DB to File.....