日期:2014-05-18  浏览次数:20594 次

用于插入的触发器怎么写?
为什么我写的这个触发器总是说在 'values中不能用列名,而应该是常量,表达式或变量 '???  
//   CREATE   TRIGGER   [Insert_Card_Info]   ON   dbo.Interface_Card_Info  
FOR   INSERT
AS
      begin
              insert     into   TianBoInterface..Interface_Card_Info
            values( "i.SquenID,i.School_ID,i.Card_ID,i.Card_OtherCode,i.Card_OtherPwd
")   from   Inserted   as   i;
      end   //  


------解决方案--------------------
CREATE TRIGGER [Insert_Card_Info] ON dbo.Interface_Card_Info
FOR INSERT
AS
begin
insert into TianBoInterface..Interface_Card_Info
(SquenID,School_ID,Card_ID,Card_OtherCode,Card_OtherPwd
) select i.SquenID,i.School_ID,i.Card_ID,i.Card_OtherCode,i.Card_OtherPwd from Inserted i
end