Using OPENQUERY with an Oracle database to query a date range

前端 未结 1 1757
旧巷少年郎
旧巷少年郎 2021-01-22 19:30

We have an Oracle database that we access through OpenQuery for some stuff. You apparently can\'t do date comparisons directly in OpenQuery using the OleDB driver, so to get aro

1条回答
  •  一整个雨季
    2021-01-22 20:25

    I found a solution to the problem. By specifying a mask for the date, it will provide the proper results. Using:

    to_char(to_date('01-JAN-2015','DD-MON-YYYY') ,'J') 
    

    instead of

    to_char(to_date('01-JAN-2015') ,'J') 
    

    Gives the same result through OpenQuery and directly from Oracle.

    0 讨论(0)
提交回复
热议问题