Junior — Middle
Explain what the BULK INSERT operator in SQL is and what it is used for.
sobes.tech AI
Answer from AI
The BULK INSERT operator in SQL is used for quickly loading large volumes of data from an external file (e.g., CSV) into a database table. It is an efficient bulk insert method that is significantly faster compared to row-by-row insertion using INSERT.
Example of usage:
BULK INSERT dbo.Products
FROM 'C:\data\products.csv'
WITH (
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
FIRSTROW = 2
);
Here, data from the file products.csv is loaded into the Products table, specifying the field and row delimiters, and skipping the header row.