I am doing:
BULK INSERT CSVTest FROM 'c:\csvtest.txt'
WITH
(FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n')
GO
--Check the content of the table.
SELECT *
FROM CSVTest
GO
--Drop the table to clean up database.
SELECT *
FROM CSVTest
GO
Is it possible to insert only specific fields FROM the csv?
Alternatively, you can bulk insert into a view.
See also this question.
You can do this using a format file. See: Using a Format File to Skip a Table Column and Using a Format File to Skip a Data Field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With