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 Error

Author  Topic 

CSK
Constraint Violating Yak Guru

489 Posts

Posted - 2006-06-13 : 06:54:56

Dear all,

How to Capture SQL Generated Error

For Ex:

Server: Msg 15009, Level 16, State 1, Procedure sp_help, Line 70
The object 'test' does not exist in database 'COMMON'
.

i Need to Capture the error.

Please give me ur suggesions

Thanks
KK

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-13 : 06:57:56
Usually this sort of error prevents the sp from compiling and is only trappable in the client.
try this
create proc b
as
select * from xxxxx
select @@error
go


create proc a
as
declare @rc int
exec @rc = b
select @rc, @@error
go

now execute a


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

CSK
Constraint Violating Yak Guru

489 Posts

Posted - 2006-06-13 : 07:12:54
Fine nr

Thanks
KK
Go to Top of Page
   

- Advertisement -