在存储过程中可以同时更新几张表吗?create proc product_update
@a nchar(5),
@b nchar(5),
@c nchar(5)
as
update table_a set a=@a
update table_a set a=@a
update table_a set a=@a还是分成三个存储过程再用ADO.NET的事务来处理好?

解决方案 »

  1.   

    在存储过程中可以同时更新几张表吗? 
    create proc product_update
    @a nchar(5),
    @b nchar(5),
    @c nchar(5)
    as
    update table_a set a=@a 
    update table_b set a=@b where table_b.ID=table_a.ID
    update table_c set a=@c where table_c.ID=table_a.ID
    还是分成三个存储过程再用ADO.NET的事务来处理好?
      

  2.   

    存储过程里也可以用事务控制啊
    begin tran
      

  3.   

    在存储过程中使用事务控制跟在ADO.NET中使用有什么区别,有什么优缺点吗?