November 12, 2010 at 8:41 am
I keep getting an error that states..."Cannot bulk load because the file "\\myPath\...\logger.txt" could not be opened."
I am getting this while trying to do a bulk insert in my procedure...here is what my code looks like...any help is much needed as I have been looking at this for a while now. I used the PRINT to look at the parameter being passed in, and it looks right.
I have checked to make sure that I have admin permissions on the file, i am also pointing to a location that is on the server and not on my local machine.
I am out of ideas...please help...Thanks
USE [myDB]
GO
/****** Object: StoredProcedure [myStoredProc] Script Date: 11/11/2010 11:15:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [myStoredProc]
@SourcePath varchar(100),
--@FormatFilePath varchar(100)
AS
SET ANSI_WARNINGS OFF
DECLARE @str_command nvarchar (150)
SET @str_command = 'BULK INSERT [histTable] FROM ''' + @SourcePath + ''' WITH (FIELDTERMINATOR = '','') '
PRINT @str_command
EXEC SP_EXECUTESQL @str_command
November 14, 2010 at 8:37 pm
The BULK INSERT statement runs as the SQL Server service (not as you). The windows account that SQL Server is running as needs to have permissions on the share (even if the share is on the same server as SQL Server).
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply