I need your help in small problem, I have a column (data type timestamp
) in SQL Server 2008.
Now I want to show this timestamp
value in ASP.Net C# app as string. Is ther开发者_如何学Goe any way to do that?
I tried it using regular data fetching in ASP.Net but it produced System.byte[] as output rather than actual value. In SQL Server Management Studio values are represented as 0x000000000000B3C0
.
One option is to change it to the Date, while getting from the database. Like:
SELECT timestamp = DATEDIFF(s, '19700101', yourTimestampColumn)
FROM yourTable
I don't know if i catch you, but in sql you can cast timestamp value to datetime then to varchar like this:
declare @val timestamp = 0x0000AAE200B29565
select cast(cast(@val as datetime) as varchar(max))
精彩评论