Home > Archive > MS SQL Server MSEQ > February 2006 > Date Range









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Date Range
Daniell

2006-02-28, 8:30 pm

I have a query that I have to place a beginning and ending date to select the
information needed. The date is always 30 days for the current date. Is
there a way to set up a query to select current date minus 30 days that I
will not have to change the date each time?

Thanks in advance for the help.
Hugo Kornelis

2006-02-28, 8:30 pm

On Tue, 28 Feb 2006 12:41:27 -0800, Daniell wrote:

>I have a query that I have to place a beginning and ending date to select the
>information needed. The date is always 30 days for the current date. Is
>there a way to set up a query to select current date minus 30 days that I
>will not have to change the date each time?
>
>Thanks in advance for the help.


Hi Daniell,

SELECT DATEADD(day, -30, CURRENT_TIMESTAMP)

--
Hugo Kornelis, SQL Server MVP
Daniell

2006-02-28, 8:30 pm

Thanks Hugo, I will give that a try.

"Hugo Kornelis" wrote:

> On Tue, 28 Feb 2006 12:41:27 -0800, Daniell wrote:
>
>
> Hi Daniell,
>
> SELECT DATEADD(day, -30, CURRENT_TIMESTAMP)
>
> --
> Hugo Kornelis, SQL Server MVP
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com