George George

George George

  • NA
  • 778
  • 0

What is the meaning of the return value and error message?

Jan 14 2009 10:28 AM

Hello everyone,

I create the following table,

[Code]
create table ABC (a varchar unique);
[/Code]

then create the following store procedure,

[Code]
CREATE PROCEDURE [dbo].[prc_AddABC] 

AS
BEGIN

INSERT INTO [dbo].[ABC]
values ('a');

SELECT @@ERROR AS ABCERROR;

END -- end of store procedure
[/Code]

After execute the procedure twice, which will cause insert duplicate value 'a' on unique column a error.

What I got from Management Studio is,


ABCERROR 2627

return value -4

My question is, why @@error is not the same as return value? what does the message and return value mean? Where could I find

related documents to read their meanings?

thanks in advance,
George


Answers (2)