January 16, 2019

Transfer Data with JSON in SQL Server

You can transfer data with JSON in SQL Server. Based on an SQL query, you can output the results into JSON format. Here is a small example: DECLARE @JSONOutput NVARCHAR(MAX) = (SELECT * FROM Students FOR JSON auto, INCLUDE_NULL_VALUES)Print @JSONOutput;This could potentially give the following result:[ { “StudentID”:1, “StudentName”:”Hannes”, “EnrolDate”:”2017-12-14T14:19:22.273″