我正在尝试执行以下命令来强制更新以使用非聚集索引:
UPDATE Flights
SET Airtime=5555678
WHERE Distance=10000
OPTION (TABLE HINT(Flights, INDEX (DistanceIndex)))
...这是错误的:
对于
TABLE HINT
语句中应如何正确形成语法,我找不到任何明确的建议。请谁能告诉我我要去哪里错了?
最佳答案
请尝试以下操作:
UPDATE F
SET F.Airtime=5555678
FROM Flights F WITH (INDEX (DistanceIndex))
WHERE F.Distance=10000
或者
UPDATE Flights
SET Airtime=5555678
FROM Flights -- this line is added to your initial query
WHERE Distance=10000
OPTION (TABLE HINT(Flights, INDEX (DistanceIndex)))