请高手帮忙,我想在存储过程中返里一个记录集和返回多个参数

USE pubs
GO
IF EXISTS(SELECT name FROM sysobjects
      WHERE name = 'titles_sum' AND type = 'P')
   DROP PROCEDURE titles_sum
GO
USE pubs
GO
CREATE PROCEDURE titles_sum @@TITLE varchar(40) = '%', @@SUM money OUTPUT
AS
SELECT 'Title Name' = title
FROM titles
WHERE title LIKE @@TITLE
SELECT @@SUM = SUM(price)
FROM titles
WHERE title LIKE @@TITLE

select * from titles
GO











请参照:
create procedure weatherSelect
(
@returnCode int=0 output,--这是返回参数
@rowCount int =0 output,--你想设几个就几个
@weatherId int,
@weatherDescription nvarchar(50)
)
as
set nocount on
select *from weather
where
(@weatherId is null or weatherId=@weatherId)and
(@weatherDescription is null or weatherDescription=@weatherDescription)

select @returnCode=@@error,@rowCount=@@rowcount
return @returnCode

GO



posted on 2005-03-13 01:07  轻松逍遥子  阅读(250)  评论(0)    收藏  举报