Crear archivo CSV desde donde se importarán los registros (ejemplo). Ejemplo de script a ejecutar:
BULK INSERT nombre_de_la_tabla FROM 'Direccion/del/archivo.csv'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ';', --CSV field delimiter
ROWTERMINATOR = '\n', --Use to shift the control to next row
--ERRORFILE = 'C:\CSVDATA\SchoolsErrorRows.csv',
TABLOCK
);
Se puede obtener este error:
Cannot bulk load because the file "Direccion/del/archivo.csv" could not be opened. Operating system error code 5(Access is denied.).
Solución: iniciar el SQL Server con autenticación de Windows.
0 comentarios:
Publicar un comentario