Last active
February 6, 2017 22:18
-
-
Save bertwagner/cf3a16c3f08595f91d1d177a64265fed to your computer and use it in GitHub Desktop.
SQL Server 2016 JSON's ISJSON() Function
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
SELECT ISJSON('{ "Color" : "Blue" }') -- Returns 1, valid | |
-- Output: 1 | |
SELECT ISJSON('{ "Color" : Blue }') -- Returns 0, invalid, missing quotes | |
-- Output: 0 | |
SELECT ISJSON('{ "Number" : 1 }') -- Returns 1, valid, numbers are allowed | |
-- Output: 1 | |
SELECT ISJSON('{ "PurchaseDate" : "2015-08-18T00:00:00.000Z" }') -- Returns 1, valid, dates are just strings in ISO 8601 date format https://en.wikipedia.org/wiki/ISO_8601 | |
-- Output: 1 | |
SELECT ISJSON('{ "PurchaseDate" : 2015-08-18 }') -- Returns 0, invalid | |
-- Output: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment