json search

  • we have json getting stored in one of the tables and how can we search inside the json.

  • Rechana Rajan (1/9/2017)


    we have json getting stored in one of the tables and how can we search inside the json.

    There is no native support for reading JSON in SQL Server 2014. I believe there is in 2016 however.

    Google did find me an answer though, I assume you didn't try searching the vast interwebs? 🙂 Searching something like "Read JSON T-SQL" set you very quickly on the path to find this article[/url]. It does seem to have some limitations, but might be something you can improve for your own needs.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Rechana Rajan (1/9/2017)


    we have json getting stored in one of the tables and how can we search inside the json.

    As Tom pointed out, there is no JSON parsing support on SQL Server 2014 and earlier so you are limited to text type searches, i.e. LIKE, PATINDEX, CHARINDEX and Full Text Searches.

    😎

    If you are on 2016, then you can use the JSON functionality to search and join the data like any other relational data set.

  • If you are comfortable using PowerShell, it has pretty decent Json support. You could wire up a script to connect to your SQL server, retrieve the data you need to filterin a query and cast the column data to a JSON variable, then do your filtering.

    Depending on how much data we're talking about tho, there could be always be performance issues from this approach.

  • Thanks Thom,Eirikur & Manic

  • You could writ a C# class with method(s) to do what you want then create as CLR assembly and user functions. Then you could manipulate the column data directly with SQL

    The probability of survival is inversely proportional to the angle of arrival.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply