I've tried bulk insert but I can't get it right. I have a table schema that starts with an id and a few more columns then I need to skip a column. Whats the proper way to assign the columns to each one from a csv?
Thanks
EDIT:
MY Code:
BULK INSERT datadb
from 'C:\datainsert.csv'
WITH
(
FIRSTROW=2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
The errors is talking about my first column being a different datatype since I have an ID column
I have tested the same and it is working without any issues.
Please post the metadata of your table and csv file, so that I will get a chance to find the issue.
Marc_s nailed it. I created a staging table and bulk loaded to that one. Then did a select into from it into my existing table. Thanks Marc_s!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.