±íA: id starTime endTime ¶¼ÊÇint×Ö¶Î 1 20091231 20100102 2 20100113 20100115 3 20100110 20100117 ÐèÇ󣺲éѯ³öÀë½ñÌì×î½üµÄÊý¾Ý£¬È磺½ñÌì2010-01-11 ת³É20100111 ÔÙ·Ö±ðÓëstarttime ºÍendtime±È½Ï£¬ÄǸö×î½Ó½ü½ñÌì²éѯÄĸö¡£ ²é³ö µÚ3Ìõ¡£SQL code: if object_id('[tb]') is not null drop table [tb] go create table [tb] (id int,starTime int,endTime int) insert into [tb] select 1,20091231,20100102 union all select 2,20100113,20100115 union all select 3,20100110,20100117
select * from [tb] where cast(convert(varchar(10),getdate(),112)as int) between starTime and endTime /* id starTime endTime ----------- ----------- ----------- 3 20100110 20100117