Hi
I have some sql that bulk inserts from a text file to a table using a format file.
USE FENSAOLD
DELETE FROM tblImportTest
BULK INSERT tblImportTest
FROM 'F:\SQLDATA\MSSQL\DATA\TEST.TXT'
WITH
(
FORMATFILE = 'F:\SQLDATA\MSSQL\DATA\bcp.fmt'
)
This works fine while the text file and format file are on the sql server.
When I move the the text file to another server and change the sql to...
USE FENSAOLD
DELETE FROM tblImportTest
BULK INSERT tblImportTest
FROM '\\CHATS-FS1\ENERGY\FENSA\SQL\TEST.TXT'
WITH
(
FORMATFILE = '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt'
)
I get the error message....
Could not bulk insert because file '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt' could not be opened. Operating system error code 5(error not found).
I assume this is some kind of permissions problem.
The SQL Server is logged into an admin account in the same domain as CHATS-FS1 and has full control to all folders and files.
If anyone can shed any light on this?
Thanks.
There are two ways to write error-free programs; only the third one works.
I have some sql that bulk inserts from a text file to a table using a format file.
USE FENSAOLD
DELETE FROM tblImportTest
BULK INSERT tblImportTest
FROM 'F:\SQLDATA\MSSQL\DATA\TEST.TXT'
WITH
(
FORMATFILE = 'F:\SQLDATA\MSSQL\DATA\bcp.fmt'
)
This works fine while the text file and format file are on the sql server.
When I move the the text file to another server and change the sql to...
USE FENSAOLD
DELETE FROM tblImportTest
BULK INSERT tblImportTest
FROM '\\CHATS-FS1\ENERGY\FENSA\SQL\TEST.TXT'
WITH
(
FORMATFILE = '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt'
)
I get the error message....
Could not bulk insert because file '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt' could not be opened. Operating system error code 5(error not found).
I assume this is some kind of permissions problem.
The SQL Server is logged into an admin account in the same domain as CHATS-FS1 and has full control to all folders and files.
If anyone can shed any light on this?
Thanks.
There are two ways to write error-free programs; only the third one works.