I would like to change this
BULK INSERT tblImportTest
FROM '\\CHATS-FS1\ENERGY\FENSA\SQL\TEST.TXT'
WITH
(
FORMATFILE = '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt'
)
So eventually I can pass the File Name. I have tried this as a test..
DECLARE @FileName VARCHAR(50)
SET @FileName = '\\CHATS-FS1\ENERGY\FENSA\SQL\Test.txt'
BULK INSERT tblImportTest
FROM @FileName
WITH
(
FORMATFILE = '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt'
)
The FROM @FileName generates an error. Is there a way to do this?
Thanks.
There are two ways to write error-free programs; only the third one works.
BULK INSERT tblImportTest
FROM '\\CHATS-FS1\ENERGY\FENSA\SQL\TEST.TXT'
WITH
(
FORMATFILE = '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt'
)
So eventually I can pass the File Name. I have tried this as a test..
DECLARE @FileName VARCHAR(50)
SET @FileName = '\\CHATS-FS1\ENERGY\FENSA\SQL\Test.txt'
BULK INSERT tblImportTest
FROM @FileName
WITH
(
FORMATFILE = '\\CHATS-FS1\ENERGY\FENSA\SQL\bcp.fmt'
)
The FROM @FileName generates an error. Is there a way to do this?
Thanks.
There are two ways to write error-free programs; only the third one works.