Hi
is there a way to get a records count when calling a stored procedure ? Like an include_count parameter.
As a workaround, the stores procedure returns 2 result sets : one with data, the second with a count of records. My problem is both result set are enclosed in array.
{
“components”: [
[
{
“count”: “1”
}
],
[
{
“ProductNumber”: “code”,
“description”: “description”
}
]
]
}
I would like to have an output like that :
{
“components”: [
{
“count”:1
},
{
“prmsProductNumber”:** “88787GR88”,
“description”:** “Description of component”,
}
]
]
Sorry for my late answer. i did not see the notification.
On stored procedure side (SQL server) I used a parameter set as output. I store the count of record in this parameter.
On SQL Server, it looks like
CREATE PROCEDURE [dbo].[myProc]
(@param1 as , @param2 as , @count as Int OUTPUT)
AS
BEGIN
– Your SQL statement to return a dataset
SELECT * FROM … WHERE …
– The same SQL statement with a rows counting
SET @COUNT = SELECT COUNT(*) FROM … WHERE …
END