sql server try catch and transaction的几个要点
2009-03-16 15:09
531 查看
msdn 把这transaction 和错误处理讲得很不错。
有什么不清楚可以看看那个。
这里摘抄重要的几句话。
"
If an error prevents the successful completion of a transaction, SQL Server automatically rolls back the transaction and frees all resources held by the transaction.
If a run-time statement error (such as a constraint violation) occurs in a batch, the default behavior in the Database Engine is to roll back only the statement that generated the error.
It is important to keep transactions as short as possible. When a transaction is started, a database management system (DBMS) must hold many resources until the end of the transaction to protect the atomicity, consistency, isolation, and durability (ACID) properties of the transaction.
A TRY…CATCH construct catches all execution errors that have a severity higher than 10 that do not close the database connection.
Errors trapped by a CATCH block are not returned to the calling application."
(如果想返回错误给程序或者客户端,使用RAISERROR)
有什么不清楚可以看看那个。
这里摘抄重要的几句话。
"
If an error prevents the successful completion of a transaction, SQL Server automatically rolls back the transaction and frees all resources held by the transaction.
If a run-time statement error (such as a constraint violation) occurs in a batch, the default behavior in the Database Engine is to roll back only the statement that generated the error.
It is important to keep transactions as short as possible. When a transaction is started, a database management system (DBMS) must hold many resources until the end of the transaction to protect the atomicity, consistency, isolation, and durability (ACID) properties of the transaction.
A TRY…CATCH construct catches all execution errors that have a severity higher than 10 that do not close the database connection.
Errors trapped by a CATCH block are not returned to the calling application."
(如果想返回错误给程序或者客户端,使用RAISERROR)
相关文章推荐
- sql server try...catch使用
- SQL Server TRY...CATCH
- Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.
- Using TRY/CATCH to Resolve a Deadlock in SQL Server 2005
- SQL Server Try Catch错误处理
- SqlServer try catch 捕获不到的一些错误及解决方法
- SQL Server Try Catch错误处理
- sql server try...catch使用
- SqlServer try catch 捕获不到的一些错误及解决方法
- SqlServer try catch 捕获不到的一些错误及解决方法
- sql server while, case,if..else ... try catch ..对象
- sqlserver try catch·
- SQL Server Try Catch错误处理
- sql server try catch
- sql server try...catch使用 异常处理 不错的SQL错误处理
- sql server TRY CATCH
- Caused by: java.sql.SQLException: Out of memory; restart server and try again (needed 142328 bytes)
- SqlServer Try Catch
- file,filegroup and tempdb in sqlserver
- SQL Server User-defined Function Create and Call 與Stored Procedures 不同