I am trying to bulk insert or update the data from a csv file to a pre-existing table in a database in SQL and I keep getting the error "Incorrect syntax near keyword 'BULK'" and I've tried everything I can find on google.
Here is the code I am working with:
CREATE VIEW [temp_table] AS
SELECT column_1, column_2...
FROM table;
BULK UPDATE [temp_table]
FROM 'C:\FileName.csv'
WITH(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
);
I have tried both UPDATE and INSERT.
I have tried importing the data directly but that just came up with a load of permission errors that I cannot get round.
I tried doing it directly from the csv file but it runs into the issue that the id column is on the database but not on the csv and the id column automatically generates numbers.
Any advise is appreciated.