aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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