if not object_id('tb') is null drop table tb go create table tb( id int identity(1,1), dt datetime, time as substring(cast(dt as varchar),11,20))insert into tb(dt) values('2008-11-13 4:06:00.000')select * from tb 1 2008-11-13 04:06:00.000 4:06AM看看这么对你有帮助吗?需要添加一个辅助列
insert @t select '2008-11-05 21:05:41.313'
select convert(varchar(10),[date],24) from @t
/*
----------
21:05:41(所影响的行数为 1 行)
*/
drop table tb
go
create table tb( id int identity(1,1), dt datetime, time as substring(cast(dt as varchar),11,20))insert into tb(dt)
values('2008-11-13 4:06:00.000')select * from tb
1 2008-11-13 04:06:00.000 4:06AM看看这么对你有帮助吗?需要添加一个辅助列