简体   繁体   中英

SQL Server 2008: No 'release savepoint' for current transaction

I'm using a PHP database abstraction layer to work with both MySQL and SQL Server. MySQL has a 'release savepoint' statement which SQL Server does not support, and I can't find a comparable statement within T-SQL to use in its stead. Does anybody know of a way around this, or can the lack of functionality be safely ignored?

I'd appreciate any insight!

Cheers

In SQL Server you do not need to do any operation to release a savepoint. Savepoints are 'released' automatically at the final transaction commit or rollback, you don't need to manage them intermediately.

The ANSI standard syntax is SAVEPOINT , ROLLBACK TO SAVEPOINT , and RELEASE SAVEPOINT . Oracle, DB/2, MySQL, Postgres, Sybase, Informix, Interbase, and Firebird all use that same, standard, syntax. SQL Server is the oddball with a different syntax and no "release".

As Remus Rusanu said, though, it's not strictly required, but could help the database manage internal resources better if it knew that the savepoint was no longer necessary (it certainly helps on multigenerational architectures like Oracle, Interbase and Firebird).

I don't know much about MySQL but it sounds a bit like using

Save Transaction <Name> and Rollback Transaction <Name>

to partially rollback a transaction to a named point. See MSDN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM