John Bristiw
John Bristiw

Reputation: 27

LinkedServer Openquery is throwing this error : ORA-00923: FROM keyword not found where expected

I am running below query in SQL Server 2012 against a linked server and i am getting below error. Am I using an incorrect keyword/function or missing any syntex. The query is running fine when I am running without openquery

ORA-00923: FROM keyword not found where expected

The query is below :

select * from openquery(LinkedServerName,
'select t.TRANSACTION,t.PARTNER,t.DATE

from

(select st.TRANSACTION,st.PARTNER,st.DATE
,RowNum = ROW_NUMBER() over(partition by st.TRANSACTION order by st.DATE desc)
from tbltransactions st) t where t.RowNum = 1')

Upvotes: 0

Views: 588

Answers (1)

Steffen Kluger
Steffen Kluger

Reputation: 26

Please try

select * from openquery(LinkedServerName,
'select t.TRANSACTION,t.PARTNER,t.DATE

from

(select st.TRANSACTION,st.PARTNER,st.DATE
,ROW_NUMBER() over(partition by st.TRANSACTION order by st.DATE desc) as RowNum
from tbltransactions st) t where t.RowNum = 1')

Upvotes: 1

Related Questions