Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 question about sql query using linked Server

Author  Topic 

swenri
Yak Posting Veteran

72 Posts

Posted - 2009-03-13 : 17:27:29
Hi all,

I 've 2 questions regarding a query in linked server .

I created a linked server using Microsoft OLE DB Provider for Oracle. I created an inner join query in Sql Server Management Studio.The inner join query without the date selection parameter but, when I use the AND (MASTER50_ENT.ORDERS.ORDER_DTM) BETWEEN to_date('01-JAN-2009', 'dd-MON-YYYY') AND to_date('31-JAN-2009','dd-MON-YYYY' ' ) AS a
it throws an error Msg 102, Level 15, State 1, Line 8
Incorrect syntax near '01'.


I’ve tried every possible way to solve it by changing the date format but, nothing seems to work.

SELECT a.* FROM OPENQUERY(TESTORALINK,'SELECT MASTER50_ENT.ORDERS.ORDER_ID, _
MASTER50_ENT.ACCOUNT.EXTERNAL_ACCOUNT_NUMBER, _
MASTER50_ENT.CONTACT.COMPANY, _
MASTER50_ENT.ACCOUNT.COUNTRY_CD
FROM MASTER50_ENT.ACCOUNT,MASTER50_ENT.ORDERS,MASTER50_ENT.CONTACT
WHERE MASTER50_ENT.ORDERS.ACCOUNT_ID = MASTER50_ENT.ACCOUNT.ACCOUNT_ID
AND MASTER50_ENT.ACCOUNT.CONTACT_ID = MASTER50_ENT.CONTACT.CONTACT_ID
AND (MASTER50_ENT.ORDERS.ORDER_DTM) BETWEEN to_date('01-JAN-2009', 'dd-MON-YYYY') AND to_date('31-JAN-2009','ddMONYYYY' ' ) AS a



Also, another question is how create a report in SSRS using the same linked server ?

Thank you for the help ….

   

- Advertisement -