Nest transactions in SQLServer
hi guys:
i am doing a hard work of migrating programs from Oracle to SQL-Server.
i encounte a problem about transaction which hardly hurt my heart (forgive my poor english first ... :-) )
you know,there is such a usage in oracle:
SAVEPOINT xxx
doing things1....
doing things2....
if error in doing things2 then
ROLLBACKTOSAVEPOINT xx
end if;
so, if things 2 failed, the data altered by things1 is guaranteed to be rollback.
but when i change it to fit sql-server, i was happily wrote such codes:
BEGIN TRANS.... //must
...
...
BEGIN TRANS... //SAVEPOINT xxx
doing things1....
doing things2....
if error in doing things2 then
ROLLBACK TRANS.... //ROLLBACKTOSAVEPOINT xx
end if;
...
...
COMMIT TRANS.
yes, i got a error: 'Cannot start more transactions on this session' (oh, these codes are under ado in delphi)
i find the answer in msdn
CAUSE
By design, OLE DB Provider for SQL Server does not allow nested transactions.
http://support.microsoft.com/default.aspx?scid=kb;en-us;316872
but,i think, such nest transcations (or same other trick equal to oracle save point) is very needed in general business process.
how to solve this problem?
my best wishes.
----------------------------------------------------------
这个贴是先发在新闻组里的,所以就没用中文,大家凑合着看看吧. :-)