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

怎么表示

2012-04-03 
如何表示 表A,有一字段为endtime,endtime的值“2007-5-228:00:00”属于datetime类型的,select*fromAwhereend

如何表示

表A,
有一字段为endtime,
endtime的值“2007-5-22   8:00:00”属于datetime类型的,

select   *   from   A   where   endtime=???
问号就是填上当天日期     +     早上八点,
请问如何表示

[解决办法]
select * from A
where endtime = convert(varchar(11),getdate(),120) + '8:00:00 '
[解决办法]
--用convert转换一下


select *
from 表名
where convert(varchar(20),endtime,120) = convert(varchar(10),getdate(),120) + ' 08:00:00 '

[解决办法]
表A,
有一字段为endtime,
endtime的值“2007-5-22 8:00:00”属于datetime类型的,

select * from A where endtime=???
问号就是填上当天日期 + 早上八点,
请问如何表示

select * from A where convert(varchar(10),getdate(),120) + ' 08:00:00 '
[解决办法]
select *
from 表名
where convert(varchar(20),endtime,120) = convert(varchar(10),getdate(),120) + ' 08:00:00 '
[解决办法]
try:
DECLARE @Time nchar(5)
SET @Time= '08:00 '
SELECT * FROM A WHERE CONVERT(nchar(16),endtime,120)=CONVERT(nchar(11),GETDATE(),120)+@Time
[解决办法]
select * from A where endtime=dateadd(hh,8,getdate())

热点排行