1

我正在尝试通过两种不同的方法执行相同的选择。

首先通过使用存储过程的表值函数

SELECT * FROM dbo.DF_PRODUCTS();

openquery是通过执行存储过程

SELECT * 
FROM openquery([servername], 
               'SET FMTONLY OFF exec DatabaseName.dbo.My_StoredProcedure')

问题是我得到了各种结果,我认为问题出在存储过程缓存中。谁能帮我这个?

4

1 回答 1

0

If you're getting different results from running the exact same code, and the 'only' (perceived) difference is that you are running one through an OPENQUERY command, do a sanity check and confirm that the OPENQUERY([servername]...) is definitely running against the same server as your first query.

The likeliest scenario is that your linked server is different to the one you're running against locally - e.g. you're running against a local database versus a development/test/staging/live database.

于 2012-12-22T20:50:20.200 回答