select * from 表
where
datepart(month,日期) beween 1 and 10 
and datepart(year,日期)=2005

解决方案 »

  1.   

    select * from tablename
    where col_date>='2005-01-01' and col_date<='2005-10-31'
      

  2.   

    churchatp1(别看资料,看聊效!) 
    select * from tablename
    where col_date>='2005-01-01' and col_date<='2005-10-31'
    不是指这个特定日期
    我想实现的是
    select * from tablename
    where col_date>='2005-01' and col_date<='2005-10'
      

  3.   

    select * from tablename
    where (month(col_date) between 1 and 10) and year(col_date)=2005
      

  4.   

    select * from tablename
    where CONVERT(varchar(5),BeginTime,120) between CONVERT(varchar(5),@BeginTime,120) and CONVERT(varchar(5),@EndTime,120
      

  5.   

    select * from tablename
    where CONVERT(varchar(7),BeginTime,120) between CONVERT(varchar(7),@BeginTime,120) and CONVERT(varchar(7),@EndTime,120
      

  6.   

    1
    select * from 表
    where
    datepart(month,日期) between 1 and 10 
    and datepart(year,日期)=2005
    这里日期要用字符型;
    2
    select * from tablename
    where (month(col_date) between 1 and 10) and year(col_date)=2005
    这里日期也是字符型;
    3
    select * from tablename
    where CONVERT(varchar(7),sdate,120) between CONVERT(varchar(7),'2005.09.01',120) and CONVERT(varchar(7),'2005.10.01',120)
    我在sql server2000下调试成功的
      

  7.   

    select * from 表 where datediff(month,'2005-1',你的时间字段)>=0 and datediff(month,你的时间字段,'2005-10')<=0
      

  8.   


    declare @start datetime
    declare @end datetime
    set @start='1993-05-29 00:00:00:00'
    set @end=getdate()
    select * from sales where convert(varchar(20),ord_date,120) 
    between left(convert(varchar(20),@start,120),7) 
    and left(convert(Varchar,@end,120),7)