Results 1 to 4 of 4

Thread: SQL Statements???

  1. #1

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    Question

    Hiya everybody

    I'm having a bit of trouble with an SQL statement and I wondered if anyone knew where I was Going wrong. I want to extract data from a table. The user can specify dates between which the data will be displayed.
    The user inputs the start and end dates which are place into the variables 'Starter' and 'Ender'.
    When I try to run the search I get the following error message:

    "Missing right parenthesis"

    Heres my SQL Statemet ( it is one long line ):

    cmmSQL = "SELECT StartDateTime, EndDateTime, DurationSecs, CallersNumber, DialledNumber,TerminatingNumber, ValuePence
    FROM Opal_Data
    WHERE TerminatingNumber = '" & PRSselecta & "'
    AND
    StartDateTime >=TODATE(" & Starter & ",DD/MM/YYYY HH:MM:SS)
    AND
    EndDateTime <=TODATE(" & Ender & ", DD/MM/YYYY HH:MM:SS) "

    Set rsCDR = cnAcqAcc.Execute(cmmSQL)
    rsCDR.MoveFirst

    Any Help appreciated!

    Cheers 'n' Beers
    Skeen
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi Skeen, What database is this coming from ?

    Ian

    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    Cool

    Hi Ian

    I'm running Oracle 8i

    Cheers 'n' beers

    Skeen
    "It wasn't the booze that made me snooze, It was the Gin that did me in!"

  4. #4
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    I'm sorry mate but I've nether used Oracle SQL before (unfortunatley it is different from SQL Server)

    but in SQL server, the equivelent of TODATE(" & Starter & ",DD/MM/YYYY HH:MM:SS), the DD/MM/YYYY HH:MM:SS part need's to be in quotes. If it doesn't in Oracle then i'm sorry I cant help.

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

Posting Permissions

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



Click Here to Expand Forum to Full Width