Skip to content

Instantly share code, notes, and snippets.

@bertwagner
Created January 25, 2017 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertwagner/29dbdb77052771f5f4f35a7bcc0b9409 to your computer and use it in GitHub Desktop.
Save bertwagner/29dbdb77052771f5f4f35a7bcc0b9409 to your computer and use it in GitHub Desktop.
SQL Server 2016 JSON's FOR JSON
-- Create our table with test data
DROP TABLE IF EXISTS ##Garage;
CREATE TABLE ##Garage
(
Id int IDENTITY(1,1),
Make varchar(100),
BaseModel varchar(50),
Trim varchar(50),
Year int,
PurchaseDate datetime2
);
INSERT INTO ##Garage VALUES ('Volkswagen', 'Golf', 'GL', 2003, '2006-10-05');
INSERT INTO ##Garage VALUES ('Subaru', 'Impreza', 'Premium', 2016, '2015-08-18');
-- Take a look at our data
SELECT * FROM ##Garage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment