Currently SQL Server 2016 CTP 3 and later releases support NVARCHAR(max) fields with JSON content. However since the type NVARCHAR(max) is totally free-form, there is no constraint on these fields.
Can I declare a constraint that prevents insertion of a non-null value that is not valid JSON?
asked Feb 9, 2016 at 19:09
1 Answer 1
Add this constraint:
ALTER TABLE [dbo].[Resource]
ADD CONSTRAINT [RESOURCE_ExtJSON_VALID]
CHECK ( ISJSON( ExtJSON )> 0 )
answered Apr 2, 2016 at 1:15
lang-sql