Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can't compare dates that way.</p> <p>When you do this:</p> <pre><code>"SELECT VALUE userInfos FROM MyDBEntities.UserInformations AS userInfos WHERE userInfos.BirthDate &lt;= 10/09/1992" </code></pre> <p><code>10/09/1992</code> is being interpreted as an <code>Int</code> value.</p> <p>Try putting single quotes around this value as in:</p> <pre><code>"SELECT VALUE userInfos FROM MyDBEntities.UserInformations AS userInfos WHERE userInfos.BirthDate &lt;= '10/09/1992'" </code></pre> <p>Probably you'll have to call a database date conversion function (depends on your database vendor) passing to it this date string.</p> <p>Like this:</p> <pre><code>"SELECT VALUE userInfos FROM MyDBEntities.UserInformations AS userInfos WHERE userInfos.BirthDate &lt;= DataBaseSpecificToDateFunction('10/09/1992')" </code></pre> <p>The problem is that this query is being sent to the database and is the database server that'll execute it. That's why you need a database specific date conversion function.</p> <p>For example: in Oracle we have the <strong>to_date</strong> function to convert a <strong>string</strong> to a <strong>datetime</strong> using a given pattern:</p> <pre><code>to_date('1998/05/31:12:00:00AM', 'yyyy/mm/dd:hh:mi:ssam') </code></pre> <p>In SQL Server we have the <code>convert</code> function as in:</p> <pre><code>convert(datetime, '2016-10-23 20:44:11',20) -- yyyy-mm-dd hh:mm:ss(24h) </code></pre> <p>More samples <a href="http://www.sqlusa.com/bestpractices/datetimeconversion/" rel="nofollow noreferrer">here</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload