begin try
BEGIN TRANSACTION
insert---
commit
end try
begin catch
print 'error: id='+@id;
if @@Trancount>0
begin
rollback TRANSACTION
--如果有cursor,别忘记关闭cursor
CLOSE cursor_distinfo
DEALLOCATE cursor_distinfo
end
end catch
文章来源:http://guming.blogbus.com/logs/23611743.html
|