Friday, March 30, 2012

OPENQUERY Parameter

I am trying to do the following:

SELECT ExpireDate
FROM OPENQUERY([10.22.10.79], Expire Date
From Product Where [ExpireDate] > 2005-12-31')
GO

However the above sql statement doesn't get the dates greater than the date provided unless there are quotes around the date. How do I add a variable that will cover this date and include the identifiers to get the correct recordsTry this:
SELECT ExpireDate
FROM OPENQUERY([10.22.10.79], 'select Expire Date From Product Where [ExpireDate] > ''2005-12-31''')
GO|||I thought I did already try that. Let me double check...|||This gives me an "Invalid Column Name" error.|||Chang "Expire Date" to "ExpireDate":
SELECT ExpireDate
FROM OPENQUERY([10.22.10.79], 'select ExpireDate From Product Where [ExpireDate] > ''2005-12-31''')

No comments:

Post a Comment