代码改变世界

数据库sql事务处理

2008-06-29 15:59  Virus-BeautyCode  阅读(322)  评论(0编辑  收藏  举报
CREATE proc proc_1
@tit1 varchar(10),
@tit2 varchar(10)
as
set nocount on
begin tran
delete from tab where title=@tit1
delete from tab where title=@tit2
IF @@ERROR <> 0
begin
rollback tran
print 'error'
return
end
ELSE
begin
commit tran
print 'ok'
end
GO