Failed to handle type conversion errors in SQL Server 2000 triggers ~~

Source: Internet
Author: User
Depressed, I want to convert a struct field into an int variable in the trigger. If an error occurs, set the variable to 0 and the result will always jump out when an error occurs, the @ error judgment is useless at all, so I searched the internet and found the SQL Server 2005 beta 2 Transact-SQL enhancement function in msdn. When talking about exception handling, I wrote the following:

SQL Server 2005 beta 2 introduces a simple but powerful exception handling mechanism in the form of try... catch Transact-SQL structure.

Earlier versions of SQL Server require that error handling be included after each statement suspected to be wrongCode. To combine the error check code, the label and the GOTO statement must be used. In addition, errors such as data type conversion errors may lead to the termination of batch processing; therefore, these errors cannot be captured using Transact-SQL. SQL Server 2005 beta 2 solves many of these problems.

It is now possible to capture and process errors that may lead to batch termination in the past, provided that these errors do not cause connection interruptions (usually errors with a severity of 21 or above, for example, suspicious table or database integrity, hardware errors, and so on ).

Reference URL: http://www.microsoft.com/china/MSDN/library/default.mspx? MFR = true

Uncomfortable ~~~~~~~~~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.