Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    3

    Unanswered: Error: Superflous

    Hi,

    i m doing a MS Query to a SQL database connecting with U/SQL ODBC. When i run the query i get the *** error: Superflous ((). The quey Statements are as follows;

    SELECT INVMOVEMENTS.EntryDate, INVMOVEMENTS.StockCode, INVMOVEMENTS.TrnQty, INVMOVEMENTS.Reference
    FROM dbo.INVMOVEMENTS INVMOVEMENTS
    WHERE (INVMOVEMENTS.EntryDate>=DATEADD("d", -7, {fn CURDATE()})ORDER BY INVMOVEMENTS.EntryDate

    I would like to extract into excel transactions that occured seven days before the current date.

    How do i resolve this error.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    If you count the number of open parentheses vs the number of closing ones you will see there is an imbalance.
    Dump the one after WHERE
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2010
    Posts
    3

    Error: Superflous

    I have balanced the brackets and now my query looks like this.

    SELECT INVMOVEMENTS.StockCode, INVMOVEMENTS.Warehouse, INVMOVEMENTS.EntryDate, INVMOVEMENTS.TrnTime,{fn CURDATE()}
    FROM dbo.INVMOVEMENTS INVMOVEMENTS
    WHERE INVMOVEMENTS.EntryDate >= DATEADD("d", -90, {fn CURDATE()})
    ORDER BY INVMOVEMENTS.EntryDate


    A small box with the title "Microsoft Office Excel" pops up with the error:
    [Transoft][TSENG32]superflous (() and an Ok button.

    Sorry im not able to copy the screen on to the post.

    Help needed.

  4. #4
    Join Date
    Feb 2004
    Posts
    193
    I changed the syntax around a bit, getdate() instead of that function for example and just "D" w/o quotes in DATEADD.


    SELECT INVMOVEMENTS.StockCode
    , INVMOVEMENTS.Warehouse
    , INVMOVEMENTS.EntryDate
    , INVMOVEMENTS.TrnTime
    , GETDATE()
    FROM dbo.INVMOVEMENTS INVMOVEMENTS
    WHERE INVMOVEMENTS.EntryDate >= DATEADD(D, -90, GETDATE())
    ORDER BY INVMOVEMENTS.EntryDate

    This link is for DATEADD as I don't know why you had "D" in quotes.

    DATEADD (Transact-SQL)

    Not sure if it will work.

    ddave

  5. #5
    Join Date
    Jan 2010
    Posts
    3
    I have tried to use the GETDATE function as per your suggestion but i still get the same error message.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •