Skip to Content
author's profile photo Former Member
Former Member

Query for selecting current date when running report

Hi all

I need a query that will copy today's date on posted sales order via DTW then that query will be linked to an alert and be sent to the sales manager every morning after the import went through successfully.

The report at the moment is running fine as i pulling through the other info required the only problem is it's pulling all the sales orrders on the system , we want it to pull only the days orders imported.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 05:57 PM

    You could use either of these queries

    SELECT T0.DocNum, T0.DocDueDate, T0.CardCode, T0.CardName, T0.DocTotal, T0.U_ROUTEMARKTN, T0.U_ROUNDS, T0.U_DAYOFWEEK

    FROM [dbo\].[ORDR\] T0

    WHERE T0.DocDate = GETDATE()

    ORDER BY T0.U_ROUTEMARKTN, T0.U_ROUNDS, T0.U_DAYOFWEEK, T0.DocDueDate

    OR

    SELECT T0.DocNum, T0.DocDueDate, T0.CardCode, T0.CardName, T0.DocTotal, T0.U_ROUTEMARKTN, T0.U_ROUNDS, T0.U_DAYOFWEEK

    FROM [dbo\].[ORDR\] T0

    WHERE DATEDIFF(Day, T0.DocDate, GETDATE()) = 0

    ORDER BY T0.U_ROUTEMARKTN, T0.U_ROUNDS, T0.U_DAYOFWEEK, T0.DocDueDate

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 23, 2008 at 04:45 PM

    Hi Bongani,

    To pull todays date from the db try - 'select getdate()'

    How you want to incorporate that into your query I leave to you.

    Hope it helps.

    Jesper

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 04:51 PM

    If you could share the query I could help you filter them for the current date

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Suda

      Please find the query below

      SELECT T0.[DocNum], T0.[DocDueDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[U_ROUTEMARKTN], T0.[U_ROUNDS], T0.[U_DAYOFWEEK]

      FROM [dbo].[ORDR] T0 ORDER BY T0.[U_ROUTEMARKTN], T0.[U_ROUNDS], T0.[U_DAYOFWEEK], T0.[DocDueDate]

  • Posted on Jul 23, 2008 at 05:53 PM

    Hi Bongani.

    Try this:

    WHERE day(t0.docdate) = day(getdate()) and month(t0.docdate) = month(getdate()) and  year(t0.docdate) = year(getdate())

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.