Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Error handling

Author  Topic 

misterraj
Yak Posting Veteran

94 Posts

Posted - 2004-12-17 : 03:17:20
I am new to SQL-server. I have a SP in where I need to handle the exceptions how do i do it?

stored_prc
{
func1()
.....
func2()
.......
}


How do I handle the error like that of try catch in .Net
Pls help...

Thanks.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-17 : 06:12:38
use
begin transaction
... do stuff
commit transaction

inside you can check for error with @@error. @@error returs an error number for the last executed statement. Read about it in BOL

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -