簡體   English   中英

在 SQL 服務器中打開查詢視圖 Oracle 中傳遞日期列

[英]Pass date column in open query view Oracle in SQL Server

誰能告訴我以下查詢是正確還是不正確。 在此我嘗試在 SQL 服務器上運行它,但視圖是在 Oracle 數據庫上創建的。 特別是日期列是否正確。 因為我沒有得到任何記錄而不是得到錯誤

返回消息“ORA-01861:文字與格式字符串不匹配”。

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

我會使用日期文字語法date '2020-06-29'所以

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

您還可以使用明確的to_date

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM