Github user LosD commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/124#discussion_r74885525
  
    --- Diff: 
jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/SQLServerQueryRewriter.java
 ---
    @@ -116,6 +116,14 @@ public String rewriteFilterItem(FilterItem item) {
                     final String dateTimeValue = "CAST('" + 
format.format(date) + "' AS DATETIME)";
     
                     sb.append(dateTimeValue);
    +
    +                //Remove TIMESTAMP token as SQL Server doesn't support it
    +                int timestampIndex = sb.lastIndexOf("TIMESTAMP");
    --- End diff --
    
    I can confirm that a TIMESTAMP is added when using this kind of query:
    ```Java
    final Table dateTest = 
strategy.getDefaultSchema().getTableByName("datetest");
    final Column created = dateTest.getColumnByName("created");
    final Column name = dateTest.getColumnByName("name");
    Query q = new Query().select(name).from(dateTest).where(created, 
OperatorType.GREATER_THAN, "2015-01-01);
    ```
    
    Retrieved from SQL Server Profiler:
    ```SQL
    SELECT dbo."datetest"."name" FROM dbo."datetest" WHERE 
dbo."datetest"."created" > TIMESTAMP '2015-01-01 00:00:00'
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to