I try to insert massive records from a text file, I try to have the id as autoincremental, when entering the other fields, and to format the date fields of YY / MM / DD at the moment of insertion in the table. Since the format of the date fields of the file is DD / MM / YY.
Text file contains;
44 fields (date fields, format day / month / year)
Table to insert:
autonumeric_id, + (when inserting the 44 fields, including date fields formatted to year / month / day)
load data local infile 'c:\ventas\vtascopia.txt'
into table ventas306 fields terminated by '¶' lines terminated by 'Þ'
(clave_area,area_vta,fecha_contable,sesion,fecha_apertura,hora_apertura,av_p,
transaccion,operacion, id_vta,tipo,origen,destino,fecha_salida,hra_salida,
f_boleto,asiento,pasajero,campo19,f_pago,ef,tb,pu,tr,doo,gp,cv,importe,
formato_salto,fecha_venta,hra_venta,corrida,empresa_corrida,t_boleto,
referencia,autorizacion,voucher,t_servicio,fecha_cierre,razon_social,rfc,
documento,empresa,fin)
(@fecha_contable, @fecha_apertura, @fecha_salida, @fecha_venta, @fecha_cierre)
SET id = null,
SET fecha_contable = STR_TO_DATE(@fecha_contable, "%Y %M %d"),
SET fecha_apertura = STR_TO_DATE(@fecha_apertura, "%Y %M %d"),
SET fecha_salida = STR_TO_DATE(@fecha_salida, "%Y %M %d"),
SET fecha_venta = STR_TO_DATE(@fecha_venta, "%Y %M %d"),
SET fecha_cierre = STR_TO_DATE(@fecha_cierre, "%Y %M %d")
Running the script like this: marks error in the next line
#1064 - Algo está equivocado en su sintax cerca '(@fecha_contable, @fecha_apertura, @fecha_salida, @fecha_venta, @fecha_cierre)