• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

SQL Dates

I need to run a report that gets the current day, then 3 months in advance.

--            AND (TblApptDetails.ApptConfirmedDate
--            BETWEEN @FromDate AND @ToDate)
0
aneilg
Asked:
aneilg
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
article on how to handle dates in general in sql server: http://www.experts-exchange.com/A_1499.html

now, what is the actual problem on your side?
* calculating the @From and @To ?
* passing the values from vb to sql ?
* something else?

please clarify
0
 
Asim NazirCommented:
Something like:
SELECT DATEADD(month, 3, GetDate())

I hope it helps.
Asim
0
 
wdosanjosCommented:
Try this:

            AND (TblApptDetails.ApptConfirmedDate
            BETWEEN CAST(GETDATE() AS SMALLDATE) AND CAST(DATEADD(month, 3, GETDATE()) AS SMALLDATE)

Open in new window


The CAST is to remove the time part.

I hope this helps.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now