Been Trying to figure this out and according to Cast and Convert Documentation on MSDN, this should be possible ( http://msdn.microsoft.com/en-us/library/ms187928.aspx )
看一下转换表。
""https://i.sstatic.net/KKs8Y.gif" alt="此处的内置图像描述"/"
我执行以下守则:
CREATE TABLE TableName (
ID bigint Identity(1,1),
SomeValue nvarchar(20) not null,
TimestampColumn timestamp not null)
Insert Into TableName (SomeValue)
values ( testing )
SELECT Convert(decimal, TimeStampColumn) from TableName
然而,我只得到以下错误:
将数据类型时间戳转换为数字出错 。
This should be possible according to the documentation or am I missing something? Note I will also need to convert back to the same timestamp value.
SELECT TimeStampColumn, Convert(timestamp, Convert(decimal, TimeStampColumn))
FROM TableName
最后,上述查询应得出相同的数值。