SQL Server: BCP vs SQLCMD - which is more efficient?

I am writing a program in C # to export SQL Server data from one database and import it into another. Since these two servers are not connected, I need to choose a method like bcp.

  • What are the differences between the two? Is more effective than the other? And in what scenarios?
  • What are the known limitations / compatibility issues for each?
  • What other methods exist for exporting data from SQL Server to files and importing from them?
  • Can I enable compression in these files while creating them using the command line instead of zipping them later?
  • Please include any other aspects that you think are important in making this decision.

Thanks in advance.

+3
source share
1 answer

It doesn’t apply to BCP, but I wrote a blog post comparing a couple of approaches for bulk data loading into SQL Server - compares SqlBulkCopy against batch inserts via SqlDataAdapter.

SqlBulkCopy is worth checking - the type of process you are using is query database 1 and retrieves SqlDataReader. Pass this SqlDataReader to SqlBulkCopy to save this data in database 2.

+2
source

Source: https://habr.com/ru/post/1770876/


All Articles