I have a SQL Server and Cache server and need to combine some data. Most all functions are working, except when I attempt to pass a date with a variable or a parameter.
Below is a test I ran (one of many).
declare @myDate datetime
set @myDate = convert(datetime,'2012-02-01',120)
select * from ccms..dbo.dcdnstat where timestamp > '2012-02-01' -- WORKS
exec( 'select * from dbo.dcdnstat where cdn = ?', 21004) at ccms -- WORKS
exec( 'select * from dbo.dcdnstat where timestamp > ?',@myDate) at ccms -- ERROR 7213
select * from ccms..dbo.dcdnstat where timestamp > @myDate -- ERROR 7322
Msg 7213, Level 16, State 1, Line 9 The attempt by the provider to pass remote stored procedure parameters to remote server 'ccms' failed. Verify that the number of parameters, the order, and the values passed are correct. Msg 7322, Level 16, State 2, Line 11 A failure occurred while giving parameter information to OLE DB provider "MSDASQL" for linked server "ccms".
I have tried different date formats, and as shown above I can query on other fields with variables and I can query on date if I use a specific value.