Search code examples
sql-serverssisinsertbulkinsert

SQL Server and bulk insert - when it will happen


My question is when bulk insert is possible while inserting rows into table? I know that we can constrain bulk insert sometimes but I've heard that if sql server will not be able to do bulk insert than it will not happen.

And when it may happen and when it cannot happen?

When we load data by SSIS and e.g. OLE DB Destination component it has option to fast load and by checking transaction log we can see that bulk insert is happening (transaction log is growing very little), but sometimes it is not happening. Why? What are conditions for bulk insert?

I'm checking this in SQL Server 2012, developer edition.


Solution

  • When you do a bulk insert, it always going to do a bulk insert. It may error, but it cannot 'not happen'. What you are actually referring to is whether the bulk insert will be minimally logged. Although the concepts are related, is a very different question. I will not reiterate here the requirements for minimally logged operations. Instead, I urge you you read the very good documentation already existing on the topic:

    Be aware that there are some differences between SQL Server 2008, 2012, 2014 and 2016, as this was an area of development and some previous restrictions were lifted in later versions. Read the articles in links above. the last article linked, The Data Loading Performance Guide is the reference on this topic.