Re: Date Range



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
.



Relevant Pages

  • Re: Compare record count in table1 to qty in table2?
    ... Here is a query I'm trying to use and, of course, it does not work: ... INNER JOIN Item_Serial ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: Compare row data and input data into a new field
    ... >>I have a simple query which I cannot seem to work out and would like some ... > Why store it in the table and recalculate it each time you need it? ... > Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: Simple SQL query question
    ... >the item, price, quantity etc. ... When I query I would like to return a ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: Help with a query please
    ... I want to run a query which will return ... UID, Total if SD is True AND ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: FTS Performance in SQL 2005
    ... Can you post you query plans and the output of statistics IO ... SQL Server MVP ... Because i've set the MAX sql-server memory to 3.5 GB instead of 4.0 GB ... cost relative to the whole batch, ...
    (microsoft.public.sqlserver.fulltext)