Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

denis_the_thief
Aged Yak Warrior

Canada
596 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
Aged Yak Warrior

USA
550 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

3873 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
596 Posts

Posted - 04/03/2013 :  16:34:52  Show Profile  Reply with Quote
Thanks
Go to Top of Page
  Previous Topic Topic Next 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.05 seconds. Powered By: Snitz Forums 2000