With this query I able to select result as JSON.
string strQuery = "declare @json varchar(max) = (select field1 from table1 FOR JSON AUTO)print @json";
How could to use this result on .Net and what type of parameter should use instead of Newtonsoft.Json.Linq.JObject
using (TestEntities objEntities = new TestEntities())
{
Newtonsoft.Json.Linq.JObject strJson = objEntities.Database.SqlQuery<Newtonsoft.Json.Linq.JObject>(strQuery).FirstOrDefault();
Response.Write(strJson.ToString());
}
printandraiserroroutput are accessed via the SqlConnection.InfoMessage event hook. Have you tried just selecting it? e.g.:select (select field1 from table1 for json auto) as MyColumnNamePRINTrather thanSELECT?PRINTis designed for informational debugging messages, not for normal data transfer, the max length is 4000 as documented