Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Codes

Status
Not open for further replies.

sdh

Programmer
Joined
Apr 30, 2001
Messages
121
Location
GB
Can anyone tell me what it means if my stored procedure returns -6


Thx

Sdh
 
Do you mean the retval of the proc?
do you have a RETURN statement in the actual procedure?
As far as my understanding goes you must explicitly set the value or else the return value will always be 0

"I'm living so far beyond my income that we may almost be said to be living apart
 
this is returned from the @return_value parameter
automatically added when i created the procedure not a return value i have added
 
so to get the value you do something like
Code:
DECLARE @retstat int
EXECUTE @retstat = SQLSERVER1.pubs.dbo.checkcontract '409-56-4008'

as opposed to
Code:
CREATE PROC MyTestProc
(
 @p1 INT OUTPUT)
AS
BEGIN
SELECT @p1 = 1
END

DECLARE @v_p1 int
EXEC MyTestProc @v_p1 OUTPUT

If the first option is the way you use it, then you must be using the RETURN statement in your proc and assigning it a value i.e. RETURN -6
Or RETURN @variablename
otherwise it should return a value of 0
(Well thats my understanding anyway!)

"I'm living so far beyond my income that we may almost be said to be living apart
 
I am running it from asp when I get this value i have just
executed from query analyser and no probs.


Would this value indicate a permissions issue?

below is the simple stored proc create statement I used
I have used a stored proc because later I will
have to extend this to update numerous tables


CREATE PROCEDURE [dbo].[usp_UpdateBadgeName]
(
@tbUsr_BadgeName varchar(50), @tbUsr_UserID int
)
AS

Begin

UPDATE [dbTophorse].[dbo].[tbLogin]
SET [tbLog_badgeName]=@tbUsr_BadgeName
WHERE tbUsr_id=@tbUsr_UserID




End

 
I dont know enough about ASP to answer the "permissions issue" part.
Have you tryed executing this from Query Analyser to see what it returns (would predict 0).
I would guess that its either how you connect to the database, i.e. the ODBC or OLEDB provider that is changing the return code - as to the exact reason, sorry dont know.



"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top