set @sql = 'BULK INSERT LogErrors from '''+rtrim(@x)+''' WITH (FIELDTERMINATOR = ''-'', ROWTERMINATOR = ''\n'')'
print @sql
exec (@sql)
The error I'm getting is this...
Cannot bulk load because the file "\\MED-WKS-21\Txt\01062013.txt" could not be
opened. Operating system error code 5(Access is denied.).
It makes sense that it's just a rights issue but I can browse to this location and open the file from the SQL server that I'm on. Do you now if there is something else I need in the code to allow myself access to the file? Thanks again!
declare @sql varchar(max);
declare @x char(50);
--set @x = 'c:\' + 'x.txt';
set @x = '\\MED-WKS-21\Txt\' + replace(convert(varchar, DATEADD(d, -1,getdate()), 101), '/', '') + '.txt';
set @sql = 'BULK INSERT LogErrors from '''+rtrim(@x)+''' WITH (FIELDTERMINATOR = ''-'', ROWTERMINATOR = ''\n'')'
print @sql
exec (@sql)
The error I'm getting is this...
Cannot bulk load because the file "\\MED-WKS-21\Txt\01062013
opened. Operating system error code 5(Access is denied.).
It makes sense that it's just a rights issue but I can browse to this location and open the file from the SQL server that I'm on. Do you now if there is something else I need in the code to allow myself access to the file? Thanks again!