命令:
select * from dbo.hmg_cahplots
返回9250行。但是,当我尝试创建一个触发器时,它失败了:
Msg 8197,Level 16,State 6,Procedure LotUpdateTrigger_tdp,Line 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的新手,我不知道如何开始这个。
谢谢 - 蒂姆
答案 0 :(得分:7)
答案 1 :(得分:2)
如果您确定此表存在并且您尝试在同一数据库中创建触发器,请在from
之前和lot.hmg_kwlotincentive = model.hmg_kwincentive,
之后删除昏迷。