bcpJson

bcpJson is a console tool to export the Data of SQL Server in JSON format.

This application is currently in alpha.

Features

  • simple & fast just like bcp.exe
  • full SQL Server database export in just one command
  • exported json files can be mongoimported to MongoDB
  • mongoimport script auto-generate NOT implemented yet
  • with GUI NOT implemented yet

Command line options

  • d Specifies the database of SQL Server which read from.
  • q A Table name or a Transact-SQL query/procedure. If the query returns multiple result sets, only the first result set is copied to the data file; subsequent result sets are ignored.
  • o out copies from the database table or view to a file / directory.
  • s Specifies the instance of SQL Server to which to connect.
  • u Specifies the login ID used to connect to SQL Server.
  • p Specifies the password for the login ID.
  • t Specifies that the tool connects to SQL Server with a trusted connection using integrated security.
Note
  • d and q should not used together. In addition when you use d, a directory path should be provided by o option; when you use q, a file path should be provided by o option
  • t should not used together with u,p

Example

  • Export all tables in the database data on the server localhost to the directory d:\temp. each table is mapped to a file with the same name.
    • bcpJson -d "data" -o "d:\temp" -s localhost -t
  • Export one query result on the server svr to a json file.
    • bcpJson -q "select * from t" -o "d:\temp.json" -s svr -t

Last edited Mar 19, 2014 at 6:28 AM by sql_chen, version 11