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)
 Using RETURN

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-05 : 07:31:59
Jenny writes "Hi all,

I have what I thought would be simple, but I haven't found the solution yet. Perhaps you can help....

I simply need to return the sum of a column. Yup, that's it.

I found a couple of articles, including the one here, but it doesn't help, except to tell me I need to use RETURN.

[simplified only a little]

CREATE STOREDPROC GetTotal
AS
DECLARE @total int
SELECT sum(fieldname) as @total
from.....
RETURN @total

Well, this doesn't work. It says I get an error on the SELECT line...

I will ultimatly use that value in an ASP.NET page.

Thanks,
Jenny"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-05 : 08:02:48
SELECT @total = sum(fieldname)
from.....
RETURN @total


Jay White
{0}
Go to Top of Page
   

- Advertisement -