create trigger tg_name
on 从表
for insert,update 
as 
set nocount on
update a set a.代码=c.代码
from 从表 a join insert b  a.id=b.id
  join A表 c on a.编号=c.编号go

解决方案 »

  1.   


    -->我觉得直接在从表上做就可以了
    create trigger tg_name 
    on 从表 
    for insert,update 
    as 
    set nocount on 
    update a set a.代码=c.代码 
    from 从表 a join insertd b  a.id=b.id 
      join A表 c on a.编号=c.编号 go
      

  2.   

    set nocount on 
    是什么意思?
      

  3.   


    SET NOCOUNT
    使返回的结果中不包含有关受 Transact-SQL 语句影响的行数的信息。语法
    SET NOCOUNT { ON | OFF }注释
    当 SET NOCOUNT 为 ON 时,不返回计数(表示受 Transact-SQL 语句影响的行数)。当 SET NOCOUNT 为 OFF 时,返回计数。即使当 SET NOCOUNT 为 ON 时,也更新 @@ROWCOUNT 函数。当 SET NOCOUNT 为 ON 时,将不给客户端发送存储过程中的每个语句的 DONE_IN_PROC 信息。当使用 Microsoft® SQL Server™ 提供的实用工具执行查询时,在 Transact-SQL 语句(如 SELECT、INSERT、UPDATE 和 DELETE)结束时将不会在查询结果中显示"nn rows affected"。如果存储过程中包含的一些语句并不返回许多实际的数据,则该设置由于大量减少了网络流量,因此可显著提高性能。SET NOCOUNT 设置是在执行或运行时设置,而不是在分析时设置。权限
    SET NOCOUNT 权限默认授予所有用户。示例
    下例在 osql 实用工具或 SQL Server 查询分析器中执行时,可防止显示有关受影响的行数的信息。USE pubs
    GO
    -- Display the count message.
    SELECT au_lname 
    FROM authors
    GO
    USE pubs
    GO
    -- SET NOCOUNT to ON and no longer display the count message.
    SET NOCOUNT ON
    GO
    SELECT au_lname 
    FROM authors
    GO
    -- Reset SET NOCOUNT to OFF.
    SET NOCOUNT OFF
    GO