简体   繁体   中英

Converting Timestamp to actual Date in SQL

i am trying to convert timestamps such as

0x0000000000C7442B
0x0000000000C7442C
0x0000000000C7442D
0x0000000000C7442E
0x0000000000C7442F
0x0000000000C74430

in SQL to date. Anyone with any idea on how to achieve it?

Here is my Query

select Fixed_assets.timestamp as Date,Fixed_assets.Description,No_ as [Tag Number],Fa_Ledger.Amount as Cost, Fixed_assets.[Location Code], [Useful Life], [Depreciation Rate]
from Fixed_assets 
inner join Fa_Ledger on Fixed_assets.No_ = Fa_Ledger.[FA No_]

You can't.

The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type.

rowversion is the synonym for the timestamp data type and is subject to the behavior of data type synonyms. In DDL statements, use rowversion instead of timestamp wherever possible.

The Transact-SQL timestamp data type is different from the timestamp data type defined in the ISO standard.

The timestamp syntax is deprecated. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

I assumed SQL Server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM