SQL Server不会在我可以查询的表上创建触发器

Tim*_*rry 1 sql-server triggers

命令:

select * from dbo.hmg_cahplots
Run Code Online (Sandbox Code Playgroud)

返回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
Run Code Online (Sandbox Code Playgroud)

我怀疑这很难解决.我假设我需要指定命名空间或其他东西.但是,我是SQL Server的新手,我不知道如何开始这个.

谢谢 - 蒂姆

use*_*076 7

  1. 您确定自己位于正确的数据库中,而不是主数据库吗?
  2. 你确定你的权限没问题吗?
  3. 你确定这是一张桌子,而不是一张视图吗?