Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Query

Query

Scheduled Pinned Locked Moved Database
databasehelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Devkranth Kishore Vanja
    wrote on last edited by
    #1

    Hi I have an sql Query to select 2 different date.. "select * from offerdate >= '31/02/2006' and offerdate <= '04/04/2007' " ... this query does not take the TO date (04/04/2007) if i give the next day date the '05/04/2007' then it is taken.... help .... thanks in advance

    J K 2 Replies Last reply
    0
    • D Devkranth Kishore Vanja

      Hi I have an sql Query to select 2 different date.. "select * from offerdate >= '31/02/2006' and offerdate <= '04/04/2007' " ... this query does not take the TO date (04/04/2007) if i give the next day date the '05/04/2007' then it is taken.... help .... thanks in advance

      J Offline
      J Offline
      jijoaresseriljose
      wrote on last edited by
      #2

      hi, try with .. select * from convert(fromdate,datetime,101)>='02/31/2006' and convert(todate,datetime,101)>='04/04/2006' and regards

      jijo jose

      D 1 Reply Last reply
      0
      • D Devkranth Kishore Vanja

        Hi I have an sql Query to select 2 different date.. "select * from offerdate >= '31/02/2006' and offerdate <= '04/04/2007' " ... this query does not take the TO date (04/04/2007) if i give the next day date the '05/04/2007' then it is taken.... help .... thanks in advance

        K Offline
        K Offline
        Krish KP
        wrote on last edited by
        #3

        DateTime data type stores both date and time. when data is given like '04/04/2006' is taken as 04/04/2006 0hrs 0min that is why dates stored having time greater than 0hrs are not listed. solution : 1. take dd, mm, yyyy seperately from the column 2. concatenate them into one string 3. convert to datetime using CONVERT function CONVERT (data_type [(length)], expression [, style]) OR you can use the next date as you have already did.

        Regards KP

        1 Reply Last reply
        0
        • J jijoaresseriljose

          hi, try with .. select * from convert(fromdate,datetime,101)>='02/31/2006' and convert(todate,datetime,101)>='04/04/2006' and regards

          jijo jose

          D Offline
          D Offline
          Devkranth Kishore Vanja
          wrote on last edited by
          #4

          hi jo I want the sqlquery in dmy format.... i used setdateformat dmy ; and my sql query..

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups