Search:     Advanced search
Browse by category:
C/C++   |   Java   |   Oracle/Database   |   SAP   |   ASP .NET   |   Mainframe-DB2   |   Freshers

How would you handle error in SQL SERVER 2008?

Add comment
Views: 58
Votes: 0
Comments: 0
SQL Server now supports the use of TRY…CATCH constructs for providing rich error handling. TRY…CATCH lets us build error handling at the level we need, in the way we need to, by setting a region where if any error occurs, it will break out of the region and head to an error handler. The basic structure is as follows:

BEGIN TRY

<code>

END TRY

BEGIN CATCH

<code>

END CATCH

So if any error occurs in the TRY block, execution is diverted to the CATCH block, and the error can be dealt.
Others in this Category
document What is a Scheduled Jobs or What is a Scheduled Tasks?
document What is Replication and Database Mirroring?
document What is PRIMARY KEY?
document What are the different index configurations a table can have?
document Q: Which is more faster - IN or EXISTS?
document What is View?
document What is sub-query? Explain properties of sub-query?
document Q: What are various constraints used in SQL?
document What is Stored Procedure?
document What is User Defined Functions? What kind of User-Defined Functions can be created?
» More articles



RSS