存储过程中加事务的方法例子
CREATE PROCEDURE sptemp
AS
begin transaction
insert into temp1(ddd) values(99)
insert into temp1(ddd) values(100)
--下面这句话报错
insert into temp1(ccc) values(101)
IF @@ERROR <> 0
ROLLBACK transaction
ELSE
COMMIT transaction
GO