Hello,
I am assuming that you want to retrieve the column value from multiple rows as a concatenated string. If this is the scenario then in SQL Server you can do so by using following Stored Proc.
CREATE FUNCTION getRows() AS
BEGIN
DECLARE @Names VARCHAR(8000)
SELECT @Names = '';
SELECT @Names = @Names + ',' + ISNULL(UserName, 'N/A')
FROM users
RETURN @Names;
END;
Following code snippet shows how you can call this proc from your client.
SqlConnection sqlCon = new SqlConnection("YOUR CON STR");
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;
cmd.CommandText = "getRows";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = sqlCon;
sqlCon.Open();
reader = cmd.ExecuteReader();
sqlConnection1.Close();
Regards,