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)
 sql server 2005 error handling

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2006-02-09 : 16:51:53
I would like to make use of the new error handling in sql server 2005
Could you please see if this sql is ok (It does compile)
CREATE PROCEDURE uspGetData
AS

declare @Error int
declare @Msg varchar(128)

set nocount on

begin try
select
SectionID,
SectionTitle
from
RISECT01
order by
SectionTitle
end try

begin catch
SET @Msg = 'Cannot retrieve Sections from Table'
RAISERROR (@Msg, 16, 1)
RETURN(@@Error)
end catch

set nocount off
   

- Advertisement -