My select statement is as follows:
SELECT L.[DATE],E.* FROM SAFETYLOGS2.DBO.LOGS AS L INNER JOIN OPENQUERY(UNIDATA,'SELECT ID,NAME1,TERMNUM FROM CONTRACTOR_MASTER WHERE CANCEL_DATE = "" AND CONT_TYPE = 1;') As E on L.contractornum = E.ID where date between @firstdate and @seconddate and logs='nologs' AND E.TERMNUM = @termnum order by L.contractornum,L.date
This works but what I want to do is move the AND E.TERMNUM = @termnum to inside the open query statement. But if I put single quotes to get the @termnum it tells me it does not like the + sign. I tried putting double quotes around it and the query does not return results. Is there a way to pass the parameter to an openquery?
Matt