开发者

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

I'm writing a program in c# to export SQL Server data from one database and importing it in another. Since these two servers are not connected I need to choose a method such as bcp.

  1. What are the differences between these two? Is one more efficient than the other? And in what scenarios?
  2. What are the known limitations/compatibility issues of each?
  3. What other methods exist to export data from SQL Server into开发者_如何转开发 files and import from them?
  4. Can I enable compression in these files at the same time as creating them via a command line switch instead of zipping them afterwards?
  5. Please include any other aspects which you think is important when making this decision.

Thanks in advance.


Doesn't cover BCP, but I did write a blog post comparing a couple of approaches for bulk loading data into SQL Server - compared SqlBulkCopy against batched inserts via SqlDataAdapter.

SqlBulkCopy is worth checking out - the kind of process you'd use is query database 1 and retrieve an SqlDataReader. Pass that SqlDataReader to SqlBulkCopy to persist that data to database 2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜