exec 存储过程名 [参数...]

解决方案 »

  1.   

    CREATE TRIGGER 名2 ON 一个表
    FOR update
    AS
    declare  cursor_insert cursor for select idno from inserted
    declare @i int
    open cursor_insert
    fetch cursor_insert into @i
    while @@fetch_status=0
    begin
      exec 储存过程名 @i
      fetch cursor_insert into @i
    end
    close cursor_insert
    deallocate cursor_insert
      

  2.   

    和在查询分析器中执行没什么区别:例如:
    --处理的存储过程
    create proc p_pro @idno int
    as
    ...处理语句
    go--触发器
    create trigger t_tt on 表
    for insert
    declare @idno int
    declare #tb for select idno from inserted  --因为可能一次插入语句有多条,所以用游标
    open #tb
    fetch next from #tb into @idno
    while @@fetch_status=0
    begin
      exec p_pro @idno
      fetch next from #tb into @idno
    end
    close #tb
    deallocate #tb
    go