首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

在MSSQL里如何取'2007-01-15 06:00:00'其中的'06:00:00'

2012-03-13 
在MSSQL里怎么取2007-01-15 06:00:00其中的06:00:00?在MSSQL里怎么取 2007-01-1506:00:00 其中的 06:0

在MSSQL里怎么取'2007-01-15 06:00:00'其中的'06:00:00'?
在MSSQL里怎么取 '2007-01-15   06:00:00 '其中的 '06:00:00 '?

我是想判断一个时间字段是否在一个范围内.(比如: '06:00:00 '- '12:00:00 ')



[解决办法]
declare @date datetime
set @date= '2007-01-15 06:00:00 '

select convert(char(8),@date,108)


select convert(char(8),getdate(),108)


[解决办法]
declare @t datetime
set @t= '2007-01-15 06:00:00 '
select CONVERT(varchar(12) , @t, 108 )

--

06:00:00

热点排行
Bad Request.