AnsweredAssumed Answered

ExecuteSQL with date parameter

Question asked by thurmes on Oct 23, 2013
Latest reply on Apr 28, 2014 by deathrobot

Title

ExecuteSQL with date parameter

Post

     I would like to use ExecuteSQL to retrieve data for me, but need to filter the data to be after a given date, which I'd like to give in a parameter. For some reason,

     this works:

     ExecuteSQL ( "
     SELECT u.BookValue 
     FROM UseMixtures u 
     WHERE u.DateUsed > DATE '2013-09-30' " ;
      "" ; ""  )
     (but the date isn't in parameter form)
      
     and this doesn't:
          ExecuteSQL ( "
          SELECT u.BookValue 
          FROM UseMixtures u 
          WHERE u.DateUsed > ? " ;
           "" ; "" ;
          "DATE '2013-09-30'" )
           
          Can anyone tell me where I went wrong? Eventually the parameter will be called from elsewhere but formatted correctly, but this simplified system should work (shouldn't it?). The result for the former is a list of values; the result for the latter is nothing (i.e., not a ?, as often shows up when I try to use ExecuteSQL).
          Thanks for any help.
          --Bill

      

Outcomes