set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
goALTER PROCEDURE [dbo].[P_hebing]
@newzu int,
@oldzu int,
@newhao varchar(10),
@oldhao varchar(10),
@gong varchar(10)
AS
set nocount on
begin tranupdate bzd set zupk=@newzu where zupk=@oldzu
update btaiinfo set zupk=@newzu where zupk=@oldzu
update bjishi  set zupk=@newzu where zupk=@oldzu
update bzu set yuanjia=(select sum(yuanjia) from bzd where zupk=@newzu), yinshou=(select sum(yinshou) from bzd where zupk=@newzu),shoukuan= (select sum(shoukuan) from bzd where zupk=@newzu), renshu=(select count(*) from bzd where zupk=@newzu) where zupk=@newzu
delete bzu where zupk=@oldzu
insert into boperec (zupk, act, comment, gong) values( @newzu, '合并组', @oldhao+ '组合并至'+ @newhao, @gong)commit tran
set nocount off
这个存储过程打开时注意,请问如何创建这样的出来.

解决方案 »

  1.   

    create PROCEDURE [dbo].[P_hebing]
    @newzu int,
    @oldzu int,
    @newhao varchar(10),
    @oldhao varchar(10),
    @gong varchar(10)
    AS
    set nocount on
    begin tranupdate bzd set zupk=@newzu where zupk=@oldzu
    update btaiinfo set zupk=@newzu where zupk=@oldzu
    update bjishi  set zupk=@newzu where zupk=@oldzu
    update bzu set yuanjia=(select sum(yuanjia) from bzd where zupk=@newzu), yinshou=(select sum(yinshou) from bzd where zupk=@newzu),shoukuan= (select sum(shoukuan) from bzd where zupk=@newzu), renshu=(select count(*) from bzd where zupk=@newzu) where zupk=@newzu
    delete bzu where zupk=@oldzu
    insert into boperec (zupk, act, comment, gong) values( @newzu, '合并组', @oldhao+ '组合并至'+ @newhao, @gong)commit tran
    set nocount off
      

  2.   

    创建不是CREATE ?
    修改才是用ALTER ..................
    关键字都分不清?