I'm trying to develop an app that can handle bulk inserts of files into a given table. The path of the files can vary so I wanted to develop a stored proc that I can call and pass in the path.
The following works well
BULK INSERT [dbo].[tblUTAClockExport]
FROM '\\warhawk\C$\test\clock_export_20180922.csv'
WITH (FIELDTERMINATOR = ',' );
... but I can't replace the path with a parameter. This fails:
declare @fname as varchar(200);
set @fname = '\\warhawk\C$\test\clock_export_20180922.csv';
BULK INSERT [dbo].[tblUTAClockExport]
FROM @fname
WITH (FIELDTERMINATOR = ',' );
Any suggestions for a work around?