Best practice for transferring a large amount of data. Using Stored Procedure or SQL Bulk Copy

c# sql sqlbulkcopy sql-server stored-procedures

Question

I have a huge amount of data from one server's different databases and tables to be transferred into another server's different databases and tables. I've created a stored procedure and my C# application doing is just passing a parameter into my stored procedure.

Lately, I discovered the SQL Bulk which is used by many programmers for transferring huge amount of data.

So which of this two is the best practice to do for transferring huge amount of data and why?

Popular Answer

Bulk Insert is blazing fast! I don't think anything is faster than doing something like this.

BULK INSERT EmployeeDB.dbo.Employees
FROM 'C:\Data\EmployeeData_c.dat'
WITH 
  (
    DATAFILETYPE = 'char',
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\r\n'
  );

See the link below for more details.

https://www.simple-talk.com/sql/learn-sql-server/bulk-inserts-via-tsql-in-sql-server/




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why