1

I have some data in multiple tables (ACTTAB, APTTAB, ...)

How do I export this data from SQL and insert into a text file?
How can I import this data into MongoDB?

2
  • Look in the books online (help) for BCP and SQLCMD which are command line applications which can dump the relevant data to a file.
    – Spörri
    Apr 29 '15 at 9:23
  • If this is simply a one-off, then use the Import/Export Wizard mssqltips.com/sqlservertutorial/202/… Apr 29 '15 at 9:26
1

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'

1
  • download that tool, but it doesn`t want to copy my data Jul 14 '16 at 10:52
1

tl:dr

The answer to your question is that you need to remodel your data for MongoDB to suit your use cases and write some ETL routine for migrating the data into a proper model which makes use of MongoDBs advantages.

On automatic conversion tools

Generally, using these tools is a bad idea. Since a tool has no idea what your use cases (and subsequently your questions to MongoDB) are, it can't even give you a raw structure which is halfway optimal. If your current models are optimal, why change the database technology? And if they aren't, why would you try to translate them "word by word"? For the features? My opinion on that

  • Data redundancy and high availability can be achieved with almost any database nowadays
  • Data partitioning might be more complicated than redundancy, though achievable
  • One should always choose the right tool for the job. If you change something as fundamental as you persistence technology, there is no easy way – if you want to do it properly

So tools which translate your current structure will always give you only the best approximation of your SQL datas translation to NoSQL. Very Bad Idea™. In my experience when using transformation tools you get over normalized data, which at best don't make use of the advantages MongoDB has to offer and at worst will be a real performance killer since there are no joins. Instead of processing one command on the database server, joins would have to be simulated in subsequent (and possibly not non-consistent) multiple queries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.