Date Question

  • Hi Guys,

    Hope all is well,

    this is a basic question to yourselfves im sure,

    can someone please tell me how i can do the following.

    I want to reference a Date table and i want to pull all information back between two dates i.e

    01/10/2010 to 25/10/2010

    How can i do this? is it ColumnName => '01/10/2010 <= '25/10/2010'

    cant figure it out!!!!

  • use and

    ColumnName => '01/10/2010 and ColumnName <= '25/10/2010'

    take care abt DateTime storing in table and comparison/condition also in same format 103/101/ yyyy-mm-dd

  • brilliant,

    Thanks for the information!!

  • Pulivarthi Sasidhar (11/6/2010)


    take care abt DateTime storing in table and comparison/condition also in same format 103/101/ yyyy-mm-dd

    Only if the column is actually a varchar (which is a seriously bad idea). If the column is datetime then the parameter values will be implicitly cast to datetime before the comparison is done and the format that the parameters are in will not matter (proving the cast will work)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hey Scott -

    Try

    WHERE date BETWEEN '2010-11-1' and '2010-11-2'

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply