select * from dbo.hmg_cahplots
返回9250行。然而,當我嘗試創建一個觸發器,它失敗:
消息8197,級別16,狀態6,過程LotUpdateTrigger_tdp,1號線 對象「dbo.hmg_cahplots」不存在,或者是這個無效 操作。
觸發代碼:
CREATE TRIGGER dbo.LotUpdateTrigger_tdp ON dbo.hmg_cahplots FOR UPDATE, INSERT
AS
BEGIN
update lot
set lot.hmg_planmodelname = model.hmg_modelname, lot.hmg_thermslotincentive = model.hmg_thermsincentive,
lot.hmg_thermslotincentive_base = model.hmg_thermsincentive_base, lot.hmg_kwlotincentive = model.hmg_kwincentive
from hmg_cahplots as lot inner join i
on lot.hmg_cahplotsid = i.hmg_cahplotsid
inner join hmg_pgecahp as proj
on proj.hmg_pgecahpid = lot.hmg_pgecahplots
left outer join hmg_pgecahpmodels as model
on model.hmg_pgecahpmodelsid = lot.hmg_cahpplanstolotsid
and model.hmg_pgecahpplansid = lot.hmg_pgecahplots
END
我懷疑這是很難解決的。我假設我需要指定一個名稱空間或其他東西。但是,我是SQL Server的新手,我不知道如何開始。
感謝蒂姆 -
我要求我們的管理員檢查#2。我正在使用MS SQL Server Management Studio Express。我會檢查文檔並試圖弄清楚我是如何知道我是否在正確的數據庫中,而不是主數據庫。有一個模式表我可以查詢,看看這是一個表或視圖? –
好的...它看起來像我試圖把觸發器放在視圖上。我給出的DB圖是錯誤的......這解釋了這個謎。感謝您的幫助整理出來。 –