Tag Info

New answers tagged


You would need to use Dynamic SQL to pass a dynamic file path to the Bulk Insert. DECLARE @FileName NVARCHAR(4000); SET @FileName = '/path/to.csv'; DECLARE @sql NVARCHAR(4000) = 'BULK INSERT #CSV FROM ''' + @FileName + ''' WITH ( FIELDTERMINATOR ='','', ROWTERMINATOR =''\n'' )'; EXEC(@sql);


It seems variable "local_infile" is turned off before loading and if you specify "--local-infile" turns on this variable. You can use following steps to load file login mysql using mysql -uroot -p set global local_infile to value 1 Then try load data local infile Hope it helps

Top 50 recent answers are included