SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Confused over return value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

denis_the_thief
Aged Yak Warrior

Canada
594 Posts

Posted - 04/03/2013 :  16:03:30  Show Profile  Reply with Quote

I was looking at this stored proc and was confused over this code. Here is a snippet:


alter PROCEDURE [xxx]
	@Lang			tinyint = 0
	,@CurrUserID	varchar(10) = null
AS

BEGIN
	DECLARE @errnum int
	 
... //I removed several lines



	exec @errnum = _OrganizationDocketRate_Fetch @Lang, @CurrUserID
END
RETURN @@ERROR
GO



What I think is that there is no point to @errnum. Is this true? i.e. I don't see how it can be returned.

ScottPletcher
Constraint Violating Yak Guru

USA
412 Posts

Posted - 04/03/2013 :  16:11:12  Show Profile  Reply with Quote
Quite right; in that code, @errnum is not used, but it will still contain the value RETURNed by the _OrganizationDocketRate_Fetch procedure.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3719 Posts

Posted - 04/03/2013 :  16:13:59  Show Profile  Reply with Quote
Instead of "RETURN @@ERROR", you can use "RETURN @@errnum", if that is indeed what you want to do. But, as written, the value of @errnum is assigned but not used, so there is no point to having it.
Go to Top of Page

denis_the_thief
Aged Yak Warrior

Canada
594 Posts

Posted - 04/03/2013 :  16:34:52  Show Profile  Reply with Quote
Thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000