Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

徵兆

當 SQL 方案已啟用交錯執行,並使用 OPTION (OPTIMIZE for) 子句時,使用相同 SQL 語句中通過之參數的 TVF (值函數) 會在第一次執行時提供不正確的結果。

解決方案

此問題已在下列SQL Server累積更新中修正:

SQL Server 2019 的累積更新 19

附註: 以下是安裝此累積更新之後,未使用交錯執行的範例:

DECLARE @start smalldatetime
SELECT count(*) FROM dbo.GetData(@start)
OPTION (OPTIMIZE FOR (@start = '2022-05-23T06:00:00'))

CREATE FUNCTION [dbo].[GetData]
(
  @start datetime
)
RETURNS TABLE AS RETURN
SELECT t.id FROM dbo.TestTable t
WHERE t.testdate >= @start
GO

CREATE TABLE [dbo].[TestTable](
       [id] [int] IDENTITY(1,1) NOT NULL,
       [testdate] [datetime] NULL
) ON [PRIMARY]
GO

每個SQL Server的新累積更新都包含上一個組建中的所有 Hotfix 與安全性修正。 建議您安裝適用于SQL Server版本的最新組建:

SQL Server 2019 的最新累積更新

狀態

Microsoft 已確認<適用於>一節中所列的 Microsoft 產品確實有上述問題。

參考

了解 Microsoft 用來說明軟體更新的術語

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×