Query by date doesn't work

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Query by date doesn't work

    I'm using Informix 9.3, If I run the query in Informix it works, when I run
    the same query in ColdFusion I get a string to date conversion. I'm using the
    Informix JDBC that comes with ColdFusion 6.1.
    SELECT uid, sdate
    FROM train_cal_test
    WHERE sdate>'10/30/2005'
    I've tried the date with and without single and double quoates.

    wantaknowcf Guest

  2. Similar Questions and Discussions

    1. date query problem, date in variable
      I am using the following query : $query_archief = "SELECT * FROM vacatures where dd_eind_plaatsing < $dd_eind_plaatsing_archief1" note:...
    2. PHP Date Query
      I'm trying to create a recordset where I query a date field in my database. I can't figure the syntax. A little help here: WHERE Category =...
    3. Date Query
      I am attempting to pull information from a database and the main criteria of how I retrieve the information in a date format. The startdate and...
    4. SQL/ASP.NET getting DATE to work in query
      I'm grabbing today's date with some ASP.net code: Dim Today As Date Today = Microsoft.VisualBasic.Today() I'm then trying to run a SQL query...
    5. Date query in ASP
      ASP/Scripting newbie question here. I have an access database that I am writing ASP pages to query and return the results. The end user can put...
  3. #2

    Default Re: Query by date doesn't work

    Try the CF function CreateODBCDate() or the Informix equivalent of TO_DATE to force the correct date-string conversion.

    JR

    jonwrob Guest

  4. #3

    Default Re: Query by date doesn't work

    User CFQUERYPARAM... it's not just good security, it speeds things up and
    resolves these variable casting problems:

    SELECT uid, sdate
    FROM train_cal_test
    WHERE sdate > <cfqueryparam cfsqltype="cf_sql_date"
    value="10/30/2005">;


    Diacritical Guest

  5. #4

    Default Re: Query by date doesn't work

    Wantaknowcf, is this an idea?

    SELECT uid, sdate
    FROM train_cal_test
    WHERE sdate > DATE('10/30/2005')

    BKBK Guest

  6. #5

    Default Re: Query by date doesn't work

    Thank you for the input. I use the date qualifier when running a query against the database and it work. I use createODBCdate when I need to save a date to the database.
    wantaknowcf Guest

  7. #6

    Default Re: Query by date doesn't work

    I want to thank everyone for their help. I found several thinks I did wrong.
    My biggest mistake was quotes around the form.date when adding or editing. I
    use Dreamweaver to create the add query and it adds the quotes. I know to
    remove them now. Informix has a date qualifier that I'm using a query to
    search, like this. where date(sdate)> date(session.svsdate).
    When I use a form to add a date to the database I use two methods to choose.
    One is CreateODBCdate() and the other is CFquerypram with the type and value.
    Thanks again with everyones help I have my date problems in Informix under
    control.



    wantaknowcf Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139