locked
the query slow? RRS feed

  • Question

  • declare @date01 date

    declare @date02 date select @date01=convert(varchar(10), dateadd(day,13,DATEADD(YEAR,-1,GETDATE())),120)

    select  @date02=convert(varchar(10), dateadd(day,1,@date01),120)


    select top 500 * from t
    where dtime >@date01 and dtime <@date02,the query is very slow,
    ;but like this, where dtime >‘2011-11-1’ and dtime <'2011-11-2',the query is quickly,why? 

    Monday, October 17, 2011 11:29 AM