--不能.要改为:
CREATE TRIGGER [equpdate] ON [dbo].[equipment] 
FOR UPDATE
AS
declare @oldbh char(10),@newbh char(10)declare new cursor local for select num from inserted
declare old cursor local for select num from deletedopen new
open oldfetch next from new into @newbh
fetch next from old into @oldbh
while @@fetch_status=0
begin
update server_t set num=@newbh where @oldbh!=@newbh
fetch next from new into @newbh
fetch next from old into @oldbh
endclose old
close new
deallocate new
deallocate old
go

解决方案 »

  1.   

    --上面这个可以实现批量修改,但按照我的理解,应该是这样做才对:
    CREATE TRIGGER [equpdate] ON [dbo].[equipment] 
    FOR UPDATE
    AS
    declare @oldbh char(10),@newbh char(10)declare new cursor local for select num from inserted
    declare old cursor local for select num from deletedopen new
    open oldfetch next from new into @newbh
    fetch next from old into @oldbh
    while @@fetch_status=0
    begin
    if @oldbh<>@newbh update server_t set num=@newbh where num=@oldbh
    fetch next from new into @newbh
    fetch next from old into @oldbh
    endclose old
    close new
    deallocate new
    deallocate old
    go
      

  2.   

    --下面这个方法更简单:CREATE TRIGGER [equpdate] ON [dbo].[equipment] 
    FOR UPDATE
    AS
    select id=identity(int,1,1),num into #t1 from inserted
    select id=identity(int,1,1),num into #t2 from deletedupdate server_t set num=b.n_num
    from server_t a join(
    select n_num=a.num,o_num=b.num
    from #t1 a join #t2 b on a.id=b.id
    where a.num<>b.num) b on a.num=b.o_num
    go
      

  3.   

    注意:
    equipment.num是主关键字有唯一的值,
    server_t.num不是关键字是有重复的值的。
    它们是一对多的关系。
      

  4.   

    企业管理器--右键表--设计表--任意字段处按右键--关系--新建--设置与其他表的关联(即那些表的字段与本表的字段有关系,要被自动更新)--设置好后,选中"对 INSERT 和 UPDATE 强制关系"--并同时选中"级联更新相关的字段",如果要级联删除,再选中"级联删除相关的记录"--最后确定就可以了
      

  5.   

    CREATE TRIGGER [equpdate] ON [dbo].[equipment] 
    FOR UPDATE
    AS
    if (select count(*) from inserted)>1
      rollback tranupdate server_t set num=(select num from inserted) where num=(select num from deleted)
    go
      

  6.   

    sqlserver 2000用上面的sqlserver 7.0用下面的
      

  7.   

    你在equipment加一个identity列
    alter table equipment add id int identity然后:
    CREATE TRIGGER [equpdate] ON [dbo].[equipment] 
    FOR UPDATE
    AS
    update A set num=B.num from server_t A,inserted B,deleted C 
    where B.id=C.id and A.num=C.num and B.num<>C.num
      

  8.   

    加一个identity列就可以批量更新了.