Getting an error accessing a .txt file.Old wayStored procedure located on server VGIWPW03-SQL and shared folder pointing to .txt files also located on VGIWPW03-SQL3. This solution is working fine.New WayWe had to move the stored procedure to a different server VGIWPSQL2. The shared folder and corresponding .txt files remains on VGIWPW03-SLQ3 server.Now running stored procedure renders an error:Could not bulk insert because file '\\VGIWPW03-SQL3\AppNet$\20100628_111354.txt' could not be opened. Operating system error code 5(Access is denied.).Code:declare @PathFileName varchar(200)set @PathFileName = '\\VGIWPW03-SQL3\AppNet$\20100628_111354.txt'If Exists(Select * From Information_Schema.Tables Where Table_Type = 'Base Table' And Table_Name = '#JobListTable') Begin Drop Table #JobListTable EndCREATE TABLE #JobListTable ( job_date datetime, job_number char(15), cost_code char(15), qty_delivered decimal(8,2), qty_received decimal(8,2), qty_diff decimal(8,2), qty_used decimal(8,2), qty_wasted decimal(8,2), plant_id char(10) )DECLARE @SQL varchar(2000) SET @SQL = 'BULK INSERT #JobListTable FROM ''' + @PathFileName + ''' WITH (FIELDTERMINATOR = ''\t'', ROWTERMINATOR = ''\n'')'EXEC (@SQL)
I assume that this has something to do with the path to the VGIWPW03_SQL server that is not working. Not sure how to get around this. Can someone please give me a hand? Thank you.