SQL Server function to convert XML to JSON formatThis weekend I decided to test the performance of searching Azure Table Storage with saved keys on Redis Cache versus without any caching (direct search). Idea came when I was watching Azure Friday on Channel9 this week as Scott Hanselman and Saurabh Pant was pointing out Application Patterns on Redis Cache.
So as a first step I decided to get "Realistic" dummy data to be generated. Usually I hold some random generated data on my local database for testing purposes. But this this time thought it will be better to code a simple Windows Forms application to generate random data (as long as we have some sample JSON data). Then decided to have my dummy table data to be parsed as in JSON format. If anyone interested, you can easily convert by using the following function
It is pretty simple actually. Conversion will take place from XML to JSON. But bear in mind that it might take some time for large data amount. So to run, simply try it as:
In this case, [DummyData] is my table where I hold my test data. I will convert it to XML on rowname Myrow and push the data into a temp table. Once I run the query I will be getting:
Simple as this. I will move to the article where we will create our own dummy data generator.
Enjoy Coding :) comments powered by Disqus