I need to return an array from stored procedure. And at client side,finally need to retrieve the data by using c# and ado.net.
CREATE PROCEDURE [dbo].[usp_testing]
AS
BEGIN
DECLARE @ARRAY TABLE(sno int,id nvarchar(50)
INSERT @ARRAY(sno,id) values(1,'v123')
INSERT @ARRAY(sno,id) values(2,'v124')
INSERT @ARRAY(sno,id) values(3,'v124')
END
This @Array table need to be returned and to be retrieved to the client side
@ARRAYis not an array: it is a table. The mechanism for obtaining a table is simple and well-practiced:To get that at the client, use either ExecuteReader or something like a DataTable if it makes you happy. Or something like dapper:
which is an array of tuples.