Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to Handle the exceptions in Sqlsrver 2005??

Answers were Sorted based on User's Feedback



How to Handle the exceptions in Sqlsrver 2005??..

Answer / manikanta.srinu

Sqlsrver 2005 introduced try-catch block in SQL. orelse you
can use Transation to Handle error in SQL

Is This Answer Correct ?    5 Yes 0 No

How to Handle the exceptions in Sqlsrver 2005??..

Answer / neetu

In SQLSERVER 2005 exceptions are handle by using RaisError
with Try catch like in other prog languages.
Begin Try

End try

Begin Catch

End Catch
BEGIN TRY

RAISERROR ('Yaa, I ma the problem', 16,1)

END TRY



BEGIN CATCH

SELECT ERROR_NUMBER() as ERROR_NUMBER,

ERROR_SEVERITY() as ERROR_SEVERITY,

ERROR_STATE() as ERROR_STATE,

ERROR_MESSAGE() as ERROR_MESSAGE

END CATCH



ERROR_NUMBER() returns the number of the error.
ERROR_SEVERITY() returns the severity.
ERROR_STATE() returns the error state number.
ERROR_PROCEDURE() returns the name of the stored procedure
or trigger where the error occurred.
ERROR_LINE() returns the line number inside the routine that
caused the error.
ERROR_MESSAGE() returns the complete text of the error
message. The text includes the values supplied for any
substitutable parameters, such as lengths, object names or
times.

Is This Answer Correct ?    3 Yes 0 No

How to Handle the exceptions in Sqlsrver 2005??..

Answer / indraneelandhavarapu

With SQL Server 2005, new error handling has been introduced
with the TRY...CATCH processing. Basically what happens is
when an error occurs the processing in the TRY block stops
and processing is then picked up in the CATCH block.

ERROR_NUMBER() Returns the number of the error
ERROR_SEVERITY() Returns the severity
ERROR_STATE() Returns the error state number
ERROR_PROCEDURE() Returns the name of the stored procedure
or trigger where the error occurred
ERROR_LINE() Returns the line number inside the routine
that caused the error
ERROR_MESSAGE() Returns the complete text of the error
message. The text includes the values supplied for any
substitutable parameters, such as lengths, object names, or
times

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

How many databases instances are there in sql server 2000?

0 Answers  


Define master database?

0 Answers  


Can we write ddl in trigger?

0 Answers  


Explain few of the new features of sql server 2008 management studio

0 Answers  


what are the steps you will take, if you are tasked with securing an sql server? : Sql server database administration

0 Answers  


Define msdb database?

0 Answers  


How do I find the sql server database version?

0 Answers  


If we delete pack Spec what will be the status of pack Body ?

0 Answers   Nagarro,


Explain the functionalities that views support?

0 Answers  


List the ways in which dynamic sql can be executed?

0 Answers  


how you can list all the tables in a database?

0 Answers  


What are scheduled tasks in sql server?

0 Answers  


Categories