会回滚~
给你的测试代码
----实验事务中有游标,存储过程的测试
create table table_1 (a int)
insert into table_1
select 1
union all
select 2
CREATE PROCEDURE [dbo].[test_insert]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
insert into test (a) values(1000);
END
GO
create table test (a int )
begin tran
insert into test (a) values (10);
insert into test (a) values (20);
declare cor cursor for select a from table_1
declare @a int
open cor
fetch next from cor into @a
while (@@fetch_status=0)
begin
insert into test (a) values (@a)
fetch next from cor into @a
end
close cor
deallocate cor
exec test_insert
insert into test (a) values (100);
insert into test (a) values (200);
rollback
select * from test
--delete from test