Date Field via ODBC

Mark24Mark24 Member Posts: 3
edited 2002-01-22 in Navision Financials
Hi All,

can anyone please tell my, why the folling SQL statement using ODBC doesn't work?
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
select "Artikelnr_"
from Artikelposten
where Buchungsdatum = '11.12.01'
</pre><HR></BLOCKQUOTE>

Buchungsdatum is a Date field.
thanks in advance

Markus

Comments

  • John_TegelaarJohn_Tegelaar Member Posts: 159
    Easiest way to see if a SQL query works as supposed, is to use Excel, Get External Data.

    To get the data back you are asking for, the query used is:

    SELECT "Item No_"
    FROM "Item Ledger Entry"
    WHERE ("Posting Date"={ts '2001-01-03 00:00:00'})

    Note that the standard SQL notation for dates (yyyy-mm-dd) must be used, including the time part.

    John
  • Mark24Mark24 Member Posts: 3
    Thanks a lot John for your replay!

    However, this doesn't work <img border="0" title="" alt="" src="images/smiles/icon_sad.gif" />

    Instead I used the MS Query from Excel and designed the SQL statemant interactively.
    MS Query created the following statement

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
    SELECT ..
    FROM ...
    WHERE (Einkaufslieferzeile.Buchungsdatum={d '2001-12-17'})
    </pre><HR></BLOCKQUOTE>

    and this works pretty well <img border="0" title="" alt="" src="images/smiles/icon_smile.gif" />

    But no idea what the 'd' bevor the date means.

    Thanks again

    Markus
Sign In or Register to comment.