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
 Transact-SQL (2000)
 Result set in a stored procedure

Author  Topic 

tfpayne
Starting Member

2 Posts

Posted - 2004-06-09 : 14:50:24
Is there a way to use a result set in a stored procedure and not declare a cursor? I want to select 1 record from a table and use the fields in calculations in the proc. Thansk

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-09 : 14:53:14
CREATE PROC SomeProc
(@Input INT, @Output INT OUTPUT)
AS

DECLARE @Var1 INT
DECLARE @var2 INT

SELECT @Var1 = Column1, @Var2 = Column2
FROM Table1
WHERE Column3 = @Input

SELECT @Output = @Var1 + @Var2

RETURN 0

GO

Tara
Go to Top of Page

tfpayne
Starting Member

2 Posts

Posted - 2004-06-09 : 15:03:01
Thanks a bunch
Go to Top of Page
   

- Advertisement -