What I'm doing is inserting into a table using bulk insert from a csv
. There are fixed number of columns which I need to input.
Code:
BULK INSERT #TEMP FROM 'c:\temp.csv'
WITH
(
FIELDTERMINATOR = ','
, ROWTERMINATOR = '\n'
, CODEPAGE = 'RAW'
,FIRSTROW =2
)
Input:
A,B,C,D,E
A,B,C,D,E
Problem:
The column containing the values E
are not to be written into the table because there is no column to store those values. When I take these values into the table, the last column is shown like this:
D,E
D,E
Question:
Is there any way to prevent the insertion of column E
into the table without using a format file? I cannot use OPENROWSET
to get these values as there are some permission issues.