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)
 Returning more than one Record from SP...

Author  Topic 

mohit_sharan
Starting Member

22 Posts

Posted - 2004-02-11 : 09:50:25
Hi ,

Is there a way in SQL Server stored procedure to return multiple records/ more than one records....?

Thanks in Advance...

-Mohit.

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-02-11 : 11:09:46
Yes, Just select the results you wish to output. Be sure to SET NOCOUNT ON at the beginning of the proc.
Go to Top of Page

a_claver1
Starting Member

4 Posts

Posted - 2004-02-11 : 11:15:20
Yes, there are three ways to return multiple records.
First, is return records as a recordset.
All "Select´s" command ina Stored Procedure, return
recordsets.
You can use nextrecordset property of the recordset
to navigate between recordsets returned by a Stored
Procedure.

The second way, is return the records as a string,
separates by comma (Simulating an array).
You can manipulate that string, and separate the
values in the client side.

Third way, is return records as xml.
Returning XML from Sql Server is very easy.

Remember XML is the future !!!

Alejandro Claver
Cali, Colombia.
Go to Top of Page

monkeybite
Posting Yak Master

152 Posts

Posted - 2004-02-11 : 13:40:41
quote:
Originally posted by a_claver1

Remember XML is the future !!!


Funny. We spend a lot of time undoing the overuse of this "technology".

~ monkey
Go to Top of Page
   

- Advertisement -