I have a .csv file that I must update to my already existing table within SQL Server. Is there a query other than a BULK INSERT that I can use for this?
Here is the database and table: Backup Database - dbo.Backup$ table

Here is the sample data that is already in the dbo.Backup$ table
Location Name
ga John
pa Sally
This is the .csv file data: (test1.csv)
Location Name
ca Jan
ky Bill
Desired output:
Location Name
ga John
pa Sally
ca Jan
ky Bill
The .csv file has the same columns. I just need to update my existing dbo.Backup$ table with the new .csv file. I am thinking I can perform a BULK INSERT command to do this, however, the column names keep importing as well.
This is what I am doing:
BULK INSERT test
FROM 'C:\Test\test1.csv'
WITH
(
rowterminator='\n',
fieldterminator=','
)
From the documentation
Skipping headers is not supported by the BULK INSERT statement.
What you can do to bypass this:
Or if this is an action you need to do on a regular basis, build an SSIS package to load the CSV into the table.
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