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 '' ')
Advertisement
Answer
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'' ) ')