export data from SQl to text file/MongoDB
There is a tool on CodePlex you can use for this, called MSSQL to MongoDB Tool. This tool will migrate all data from MSSQL to MongoDB. It will do this without exporting to a file first.
If you want to export to file first, you are best off using the Export Data wizard which you can find in your SSMS, by right clicking your DB and choose 'Export Data' under 'Tasks'