create proc sp_test
as
set xact_abort on --设置后,出错会自动回滚事务
begin tran
Insert Into tb1 (col1,col2,...)
select col1,col2,... from tb2
commit tran
go
本文介绍了一个简单的存储过程sp_test的创建方法,该过程用于将数据从表tb2迁移到tb1中,并通过设置xact_abort选项确保了事务的一致性和完整性。
create proc sp_test
as
set xact_abort on --设置后,出错会自动回滚事务
begin tran
Insert Into tb1 (col1,col2,...)
select col1,col2,... from tb2
commit tran
go
1935
885

被折叠的 条评论
为什么被折叠?