Doing a bulk insert in SQL Server 2012
Posted on 2013-01-07
I am trying to do a bulk insert from a csv file in SQL Sercer 2012:
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
The problem is, the csv is missing a column that the table has. The table has Alias_ID that is supposed to auto increment by one every time a row is inserted. The CSV does not have this column so I get errors when I try to do this bulk insert. How can I handle a bulk insert where the columns do not match? I did try to edit the csv file so that there were blank values for the first column which I created called AliasID and just leaving a blank and a comma to signify no data but I guess that would be invalid since an ID column should not be null. Thanks in advance.