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??

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is BCNF? How is it better than 2NF & 3NF?

994


How to start and end transact-sql statements?

1002


if you encounter this kind of an error message, what you need to look into to solve this problem? : Sql server database administration

959


What is a not null constraint?

1003


What is your recommendation for a query running very slow? : sql server database administration

1024


Explain the architecture of ms sql reporting service?

903


Is it safe to delete log files?

899


What is ssl in sql server?

1054


What is a heap?

1020


Can a stored procedure call itself or recursive stored procedure? How many levels sp nesting is possible?

934


What happens if ntwdblib.dll is missing on your machine?

1127


What is a primary key?

931


What is the cartesian product of table?

991


Sql server reporting services vs. Crystal reports.

131


What is an execution plan?

1116