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
 SQL Server Development (2000)
 Data conversion Error Hanling Mechanism

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-18 : 09:22:21
ashish writes "Hi
I have developed error handling method in stored procedure which return error to Calling/Parent procedure. It works well in most of the cases but when data conversion fails it used to stop that procedure abruptly and does not return error message. I found that even if data conversion error happens @@error constant shows 0 inspite of showing non zero value.
I used following code
select @pcurrent_balance = Cast(@tloan_principle_amt as money)

select @terror = @@error
if @terror <> 0
begin
select @pfield_name = 'loan_principle_amt',
@pfield_value = @tloan_principle_amt,
@tstatus_id = 101, -- Data Conversion Failed
@tsql_error_id = @terror
goto exception_log
end

Please give me some guideline if you have faced this problem.Your help is much appriciated.
Thanks"

nr
SQLTeam MVY

12543 Posts

Posted - 2001-12-18 : 10:10:23
>> I found that even if data conversion error happens @@error constant shows 0 inspite of showing non zero value.

Not sure what you mean here.
Are you saying it gets an error but does not log it?
Maybe the @pfield_value is too small to hold the @tloan_principle_amt.

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -