FOR JSON path returns less number of Rows on AZURE SQL

前端 未结 5 646
余生分开走
余生分开走 2020-12-11 19:57

I am using AZURE SQL (SQL Server 2016) and creating a query to give me output in JSON object. I am adding FOR JSON PATH at the end of query.

When I exe

5条回答
  •  旧时难觅i
    2020-12-11 20:27

    If your query returned more then 2033 charters then there will be rows. Each row contains 2033 charters data another row contains remaining data. So you need to merge to get actual json. As seen below code sample.

    dynamic jsonReturned = unitOfWork
            .Database
            .FetchProc("storedProcedureGetSaleData", new { ProductId = productId });
    
        if (Enumerable.Count(jsonReturned) == 0)
        {
            return null;
        }
    
        dynamic combinedJson = "";
        foreach (var resultJsonRow in jsonReturned)
        {
            combinedJson += resultJsonRow;
        }
    
        return combinedJsonResult;
    

提交回复
热议问题