Elliott Berkihiser (10/29/2012)
Re: "OpenQuery does not accept variables" --This runs fine in my set-up:
Select * from OpenQuery(MyLinkedServer,'Declare @name varchar(50) Set @name=''RemoteDB'' Select * from sys.databases where name=@name')
Note the declaration of the variable within the query statement (and the assignment of a value with double quotes).
HTH
Elliott
In your example, OpenQuery is not 'accepting' a variable. The OpenQuery argument is static, even though it contains a variable.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.