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. Date Problem : Urgent

Date Problem : Urgent

Scheduled Pinned Locked Moved Database
databasehelp
5 Posts 4 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.
  • S Offline
    S Offline
    Suryanairg
    wrote on last edited by
    #1

    I have a problem with one of my sql query Start Date is 10/11/2007 (dd/mm/yyy format) End Date :10/12/2007 I have to get all dates listed from 11/11/2007 to 9/12/2007 (all dates between Start Date & End Date Pls help me...

    Sunil Nair

    P A J 3 Replies Last reply
    0
    • S Suryanairg

      I have a problem with one of my sql query Start Date is 10/11/2007 (dd/mm/yyy format) End Date :10/12/2007 I have to get all dates listed from 11/11/2007 to 9/12/2007 (all dates between Start Date & End Date Pls help me...

      Sunil Nair

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      select * from table1 where mydate between @startdate and @enddate. Take a look at UTC and datetime formats to make sure that you are working with your date properly (you are using a stored procedure aren't you - and you are passing @startdate and @enddate in as datetime). -- modified at 4:36 Tuesday 13th November, 2007 Ah - I see from others that you are trying to solve a different problem. Oh well.:^)

      Deja View - the feeling that you've seen this post before.

      A 1 Reply Last reply
      0
      • S Suryanairg

        I have a problem with one of my sql query Start Date is 10/11/2007 (dd/mm/yyy format) End Date :10/12/2007 I have to get all dates listed from 11/11/2007 to 9/12/2007 (all dates between Start Date & End Date Pls help me...

        Sunil Nair

        A Offline
        A Offline
        Adeel Chaudhry
        wrote on last edited by
        #3

        Hi, Use DATEADD function. For details: http://msdn2.microsoft.com/en-us/library/aa258267(sql.80).aspx[^] And place a loop with a check, if equals the end date, stop. Regards, Adeel

        Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.

        1 Reply Last reply
        0
        • S Suryanairg

          I have a problem with one of my sql query Start Date is 10/11/2007 (dd/mm/yyy format) End Date :10/12/2007 I have to get all dates listed from 11/11/2007 to 9/12/2007 (all dates between Start Date & End Date Pls help me...

          Sunil Nair

          J Offline
          J Offline
          joemonvarghese
          wrote on last edited by
          #4

          hi while @fromdate<=@todate begin print dateadd(day,1,@fromdate) set @fromdate=dateadd(day,1,@fromdate) end try this Regards Joe

          1 Reply Last reply
          0
          • P Pete OHanlon

            select * from table1 where mydate between @startdate and @enddate. Take a look at UTC and datetime formats to make sure that you are working with your date properly (you are using a stored procedure aren't you - and you are passing @startdate and @enddate in as datetime). -- modified at 4:36 Tuesday 13th November, 2007 Ah - I see from others that you are trying to solve a different problem. Oh well.:^)

            Deja View - the feeling that you've seen this post before.

            A Offline
            A Offline
            Adeel Chaudhry
            wrote on last edited by
            #5

            Pete, Unless and untill we get to know what solution was exactly required, we are not very sure of the problem. :) Regards, Adeel

            Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.

            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