pass variable to openquery sql server code example
Example 1: CONNECT VARIABLE TO AN OPENQUERY TO A LINKED SERVER ON A JOIN
exec sp_serveroption @server='myserver', @optname='rpc', @optvalue='true'
exec sp_serveroption @server='myserver', @optname='rpc out', @optvalue='true'
Example 2: CONNECT VARIABLE TO AN OPENQUERY TO A LINKED SERVER ON A JOIN
EXEC sp_addlinkedserver @server='SQL2005', @srvproduct='', @provider='SQLNCLI', @datasrc='SERVER1\SQL2005'