I'm trying to bulk insert a csv file and have columns which include dates that are in the DD/MM/YYYY format when the sql DATE format is YYYY-MM-DD and some are even D/M/YYYY as it isn't 01/01/2020 instead it is 1/1/2020 so I don't think I can slice the string.
BULK INSERT orders
FROM 'C:Orders.csv'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ',', --CSV field delimiter
ROWTERMINATOR = '
', --Use to shift the control to next row
ERRORFILE = 'C:OrdersErrorRows.csv',
TABLOCK
);
question from:
https://stackoverflow.com/questions/65949303/how-to-insert-dd-mm-yyyy-into-sql-server-date-format 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…