sql-server-rest-api icon indicating copy to clipboard operation
sql-server-rest-api copied to clipboard

sql server version

Open cissemy opened this issue 7 years ago • 5 comments

Hi, Can sql-server-rest-api work on sql server 2014 or before ?

cissemy avatar Mar 04 '17 15:03 cissemy

Yes, since it is just a wrapper around ADO.NET. However, note that the functions that generates OData and JQuery DataTable responses as JSON rely on FOR JSON clause that is available only in SQL2016.

jovanpop-msft avatar Mar 13 '17 09:03 jovanpop-msft

Hi, In your rest api you only implemented R part of CRUD: // GET api/People/Load [HttpGet("Load")] public async Task Load() { await sqlQuery.Stream("select * from people for json path", Response.Body, "[]"); } How to implement Create and Update and Delete?

cissemy avatar Oct 04 '17 14:10 cissemy

You can a create stored procedure that parses input JSON using OPENJSON and insert it into a table. Take a look at SQL Server GitHub samples:

  • Controller: https://github.com/Microsoft/sql-server-samples/blob/master/samples/features/json/product-catalog/dotnet-rest-api/Controllers/ProductController.cs
  • DB&procedures: https://github.com/Microsoft/sql-server-samples/blob/master/samples/features/json/product-catalog/dotnet-rest-api/sql-scripts/setup.sql

Instead of stored procedure, you can directly embed the SQL in code.

JocaPC avatar Oct 04 '17 14:10 JocaPC

Thank you. This way I do not need MongoDB.

On Wed, Oct 4, 2017 at 10:48 AM, Jovan Popovic [email protected] wrote:

You can a create stored procedure that parses input JSON using OPENJSON and insert it into a table. Take a look at SQL Server GitHub samples:

Instead of stored procedure, you can directly embed the SQL in code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/sql-server-rest-api/issues/1#issuecomment-334180405, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiWnxTSUImxQhZ_bfm2X3jJuYRHJoks5so5q6gaJpZM4MTH3y .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy avatar Oct 04 '17 15:10 cissemy

Hi, I am trying to build the sample but i am getting the following error : attached file. Thanks

On Wed, Oct 4, 2017 at 10:48 AM, Jovan Popovic [email protected] wrote:

You can a create stored procedure that parses input JSON using OPENJSON and insert it into a table. Take a look at SQL Server GitHub samples:

Instead of stored procedure, you can directly embed the SQL in code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JocaPC/sql-server-rest-api/issues/1#issuecomment-334180405, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFUiWnxTSUImxQhZ_bfm2X3jJuYRHJoks5so5q6gaJpZM4MTH3y .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy avatar Oct 13 '17 09:10 cissemy