Exceptions handling using try….Catch in MS SQL 2005(codegroups.com)

submitted by shaileshkshaileshk(20) 4 years ago

Exceptions handling using try….Catch in MS SQL 2005 Microsoft Add new feature ‘Try…Catch’ in MS SQL 2005. You can exception handling in MS SQL 2005 using the Try Catch. If divide by zero exception then returns the error is ‘Divide by Zero error encountered. i.e Declare @i int,@j int Select @i=200,@j=0 Select @i/@j Print @@Error Run this query in Query analyzer. you will get the error message Divide by Zero error encountered. Syntex for Try….Catch BEGIN TRY END TRY BEGIN CATCH END CATCH DECLARE @i int , @j int SELECT @i =100, @j =0 BEGIN TRY SELECT @i/@j END TRY BEGIN CATCH SELECT ERROR_NUMBER() as ErrorNo, ERROR_MESSAGE() as ErrMessage END CATCH

add a comment |category: |Views: 39

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story