on 09-24-2010 3:41 AM
I have a requirement where the sender stored procedure should return mutiple rows of data(MS SQL Server)
Can you help with the JDBC Stored Procedure Code which can return recordsets ?
Warm Regards,
Rahul J
Result sets are what you get when you run a simple SELECT statement inside a stored procedure. Let's suppose you want a stored procedure to return a list of all the people with a given last name. The code for the stored procedure might look like this:
CREATE PROCEDURE dbo.GetPeopleByLastName (@LastName NVARCHAR(50))
AS
SELECT ContactID,
FirstName,
LastName
FROM Person.Contact
WHERE LastName = @LastName
ORDER BY ContactIDIf you just execute this stored procedure in SQL Server Management Studio you get a result set that looks like this:
EXEC dbo.GetPeopleByLastName @LastName = 'Alexander'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ContactID FirstName LastName
-
-
-
22 J. Phillip Alexander
23 Michelle Alexander
430 Mary Alexander
. . . { hiding a bunch of rows } . . .
19942 Morgan Alexander
(123 row(s) affected)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes u will not require Return resultset.
you will have to define the source data type as
<resultset>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
</resultset>
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.