,ch03.13605 Page 130 Wednesday, November 29, 2000 4:42
,ch03.13605 Page 131 Wednesday, November 29, 2000 4:42 PM SAVEPOINT command is that transactions may be partially rolled back to a unique savepoint marker using the ROLLBACK command. Vendor SQL Server Supported, with variations MySQL Not supported Oracle Supported PostgreSQL Not supported Command SQL99 Syntax and Description SAVEPOINT savepoint_name Some vendors allow duplicate savepoint names within a transaction, but this is not recommended. Substitute savepoint identifiers (in the format :X) also may be included to enable DBMS to track the savepoint with an integer rather than a name. Not all vendors support this approach, and it is not recommended as the best practice. Note that SQL99 supports the statement RELEASE SAVEPOINT savepoint_name, enabling an existing savepoint to be eliminated. However, this statement is not supported by any of the vendors covered in this book. Microsoft SQL Server Syntax and Variations SAVE TRAN[SACTION] {savepoint_name | @savepoint_variable} Microsoft SQL Server does not support the SAVEPOINT command. Instead, it uses the SAVE command. Rather than declaring the literal name of the savepoint, you can reference a variable containing the name of the savepoint. When the ROLLBACK TRAN savepoint_name command is executed, SQL Server rolls the transaction back to the appropriate savepoint, then continues processing at the next valid Transact-SQL command following the ROLLBACK statement. Finally, the transaction must be concluded with a COMMIT or a final ROLLBACK statement. Oracle Syntax and Variations SAVEPOINT savepoint_name Oracle fully supports the SQL99 implementation. Example This example performs several data modifications, rolls back to a savepoint, and then rolls back the transaction completely: INSERT INTO sales VALUES(’7896′,’JR3435′,’Oct 28 1997′,25,’Net 60′,’BU7832′); SAVEPOINT after_insert; UPDATE sales SET terms = ‘Net 90′ WHERE sales_id = ‘7896′; Statements SAVEPOINT 131
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP MySQL Web Hosting services