为什么弹出----错误207:列名'客户编号'无效?CREATE TRIGGER insertgoods ON ordergoods
AFTER INSERT
As
begin
  declare
  @goodstotal money,
  @postagetotal money
  select @goodstotal = sum(数量*价格) from ordergoods
         where 客户编号 = (select 客户编号 from inserted)
  select @postagetotal = sum(数量*邮费) from ordergoods
         where 客户编号 = (select 客户编号 from inserted)
  update customers set
         商品总价 = @goodstotal,
         邮费总价 = @postagetotal,
         总价 = @goodstotal + @postagetotal
         where 客户编号 = (select 客户编号 from inserted)
end使用“select 客户编号 from ordergoods”能查到此列

解决方案 »

  1.   

    "customers"表有字段名为"客户编号"么?
      

  2.   

    --try
    select top 1 客户编号 from customers
      

  3.   

    --try
    select top 1 客户编号 from customers
    后显示:服务器: 消息 207,级别 16,状态 3,行 1
    列名 '客户编号' 无效。
    "customers"表中没有有字段名为"客户编号"
      

  4.   

    customers--有没有列"客户编号"楼主的触发器,一次插入多条时就会报错