Last active
February 24, 2021 22:27
-
-
Save ptdel/d5cd9306567ace0044777009b0d6a1cd to your computer and use it in GitHub Desktop.
load JSON into table with GUID primary key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @json NVARCHAR(MAX) = N'{"json":"here"}'; | |
INSERT INTO tableName (Id, columnA, columnB, ...) | |
SELECT NEWID(), * FROM OPENJSON(@json) | |
WITH ( | |
columnA VARCHAR(255) '$.columnA', | |
columnB VARCHAR(255) '$.columnB', | |
... | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment