我想要在鏈接服務器上更新查詢結果以及鏈接服務器。使用嵌套子查詢對鏈接服務器進行更新
第一個SQL片段給我的價值被更新:
SELECT mmdb_vessel.IMONo, mmdb_vessel.DeathDate
From OPENQUERY(MMDB, 'SELECT FunctionalLocation, IMONo, VesselStatus, CONVERT(VARCHAR(10), DeathDate, 102) AS DeathDate
FROM VESSEL
WHERE VESSEL.VesselStatusID <> 42 AND VESSEL.DeathDate is not null') as mmdb_vessel
, eb_all_v
WHERE
eb_all_v.IMO_No = mmdb_vessel.IMONo
AND eb_all_v.status = 'in service'
第二個實際上是什麼,我不能夠實現,它應該顯示我想達到的目標:
UPDATE EPI2..EPI.PLANT
SET KIND_OF_LIQUIDATION_NO = 1
, LIQUIDATION_DATE = [result from snippet above].DeathDate
Where EPI2..EPI.PLANT.IMONo = [result from snippet above].IMONo
我不太確定我的解釋是否足夠,請隨時索取更多信息!
謝謝,已經提前, 沃納
爲什麼你不能運行你的理想查詢?是否存在錯誤或其他限制? – JNK