ufts难题

newqq 2008-05-13 11:04:56
sql数据库表中有个字段ufts,是个时间戳,它是以二进制形式存储的(0x000000000227D5AA),
我现在有表A
create table A(ccode varchar(20),ufts timestamp)
insert into A(ccode) values('GK0401057')
select * from A 结果
GK0401057 0x0000000000000A29--自动生成

我要问的是,如何将 0x0000000000000A29 不是以二进制的形式取出来
就是转换成时间或者字符以后取出来,
我用 select cast(ufts as varchar(50)) from A 得到的结果是空的
可不可以把0x0000000000000A29变成字符串以后取出来,谢谢:)
...全文
240 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Limpire 2008-05-13
  • 打赏
  • 举报
回复
if object_id('tempdb.dbo.#') is not null drop table #
create table # (id int, ufts timestamp)
insert #(id) select 1

select id, ufts, str_ufts=master.dbo.fn_varbintohexstr(ufts) from #
/*
id ufts str_ufts
----------- ------------------ ------------------
1 0x00000000000007D1 0x00000000000007d2
*/
Limpire 2008-05-13
  • 打赏
  • 举报
回复
if object_id('tempdb.dbo.#') is not null drop table #
create table # (id int, ufts timestamp)
insert #(id) select 1

select id, ufts, str_ufts=dbo.fn_varbintohexstr(ufts) from #
/*
id ufts str_ufts
----------- ------------------ ------------------
1 0x00000000000007D1 0x00000000000007d1
*/
newqq 2008-05-13
  • 打赏
  • 举报
回复
自己顶一下

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧