begin try
BEGIN TRANSACTION
insert---
commit
end try
begin catch
print 'error: id='+@id;
if @@Trancount>0
begin
rollback TRANSACTION
--如果有cursor,別忘記關(guān)閉cursor
CLOSE cursor_distinfo
DEALLOCATE cursor_distinfo
end
end catch
文章來(lái)源:http://guming.blogbus.com/logs/23611743.html
|