Monday, May 11, 2015

Tips and trick to format SQL Reponse in JSON format using DocumentDB

 Recently Microsoft made it easy to migrate data form certain sources to DocumentDB on Microsoft Azure. Review post here.

The following source data can be migrated to DocumentDB using the migration tool:
  • CSV file or files
  • JSON file or files
  • SQL
  • MongoDB
  • DocumentDB

  • This post shows how you may obtain response to your SQL query in JSON format using the migration tool.

    You start with a SQL query that can be run on the instance of SQL Server 2012 (in this case). Make sure of your instance name and that you have permissions to run the query on the objects you want to use.

    You need to download the migration tool described in the link above and launch it. The tool requires input information from the source,
    Connection information and either a query file or the query itself. For some unknown reason using the query file failed, but providing a query did succeed.

    Here is the query and the location of JSON response as entered on the migration tool:

     
    Here is the JSON formatted response from the migration tool:
     
     
     

    No comments:

    DMCA.com Protection Status