1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00

Updated EF JSON sample

Aded search, JSON index, cleaned-up code.
This commit is contained in:
Jovan Popovic
2017-01-15 17:50:27 +01:00
parent 20486d03b3
commit 0d039ac0c9
5 changed files with 38 additions and 7 deletions

View File

@ -30,3 +30,11 @@ INSERT INTO Blogs (Url, Tags, Owner) VALUES
('http://blogs.msdn.com/visualstudio', '[".Net", "VS"]','{"Name":"Jack","Surname":"Doe","Email":"jack.doe@contoso.com"}'),
('https://blogs.msdn.microsoft.com/sqlserverstorageengine/', '["SQL Server"]','{"Name":"Mike","Surname":"Doe","Email":"mike.doe@contoso.com"}')
-- Add indexing on Name property in JSON column:
ALTER TABLE Blogs
ADD OwnerName AS JSON_VALUE(Owner, '$.Name');
CREATE INDEX ix_OwnerName
ON Blogs(OwnerName);