|
 |
asp_databases thread: Using SELECT in stored procedures to return multiple recs
Message #1 by srotondo@h... on Fri, 8 Nov 2002 17:36:24
|
|
In my ASP code, I'm trying to execute a stored procedure to return
multiple records to a record set. Once I have all the recs, I can process
them with the record set.
The only problem is that my SP returns only one record.
Here's my sp code:
CREATE PROCEDURE procGetArticle2
@title varchar(100) output,
@author varchar(100) output,
@position varchar(100) output,
@location varchar(100) output,
@eventDate datetime output,
@textFile varchar(200) output
AS
select @title = title,
@author = author,
@Position = jobPosition,
@location = location,
@eventDate = eventDate,
@textFile = textFile
from news
GO
If I call this procedure from asp or from SQL Server Query analyzer, it
returns only one rec (the last one on the table).
If I remove the select statement from the SP (and remove the variables),
it returns plenty of recs.
What's wrong with my stored procedure? How do I tell the SP to pass all
the records to the calling program?
Thank you.
Sal
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 11 Nov 2002 11:05:22 +1100
|
|
CREATE PROCEDURE procGetArticle2
AS
SELECT
Title,
Author,
JobPosition,
[Location],
EventDate,
TextFile
FROM
News
GO
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <srotondo@h...>
Subject: [asp_databases] Using SELECT in stored procedures to return
multiple recs
: In my ASP code, I'm trying to execute a stored procedure to return
: multiple records to a record set. Once I have all the recs, I can process
: them with the record set.
:
: The only problem is that my SP returns only one record.
:
: Here's my sp code:
:
:
: CREATE PROCEDURE procGetArticle2
: @title varchar(100) output,
: @author varchar(100) output,
: @position varchar(100) output,
: @location varchar(100) output,
: @eventDate datetime output,
: @textFile varchar(200) output
:
: AS
:
: select @title = title,
: @author = author,
: @Position = jobPosition,
: @location = location,
: @eventDate = eventDate,
: @textFile = textFile
: from news
: GO
:
: If I call this procedure from asp or from SQL Server Query analyzer, it
: returns only one rec (the last one on the table).
:
: If I remove the select statement from the SP (and remove the variables),
: it returns plenty of recs.
:
: What's wrong with my stored procedure? How do I tell the SP to pass all
: the records to the calling program?
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
|
|
 |