简体   繁体   中英

Pass date column in open query view Oracle in SQL Server

Can anyone please tell me if the below query is correct or Incorrect. In this am trying to run it on SQL Server but the view is created on Oracle database. Especially date column is proper or not. as am not getting any record instead of that getting error

returned message "ORA-01861: literal does not match format string".

select *
from openquery(Oracle,'select "bs" from temp.views_employe where "Joining Date">=''2020-06-29 '' ')

I'd use the date literal syntax date '2020-06-29' so

select * 
  from openquery(Oracle,
                 'select "bs" from temp.views_employe where "Joining Date">= date ''2020-06-29'' ')

You could also use an explicit to_date

select * 
  from openquery(Oracle,
                 'select "bs" from temp.views_employe where "Joining Date">= to_date( ''2020-06-29'', ''YYYY-MM-DD'' ) ')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM