MarkButler
Programmer
I am having a problem supplying a file name to a bulk insert command. In the following I am trying to build the file name using a directory which may change between servers and the fixed file name.
Trying to run it as above I get the following:
Line 5: Incorrect syntax near '@provlist'.
Running it as follows works as advertised.
How can I build the input file name and supply it to the command?
TIA
Mark
Code:
DECLARE @updates_dir varchar (500), @provlist varchar(500)
SET @updates_dir = 'd:\updates\'
SET @provlist = @updates_dir + 'provlist.seq'
BULK INSERT T1_WORK
FROM @provlist
WITH
(
DATAFILETYPE = 'char',
ROWTERMINATOR = '\n'
)
Trying to run it as above I get the following:
Line 5: Incorrect syntax near '@provlist'.
Running it as follows works as advertised.
Code:
BULK INSERT T1_WORK
FROM 'D:\UPDATES\PROVLIST.SEQ'
WITH
(
DATAFILETYPE = 'char',
ROWTERMINATOR = '\n'
)
How can I build the input file name and supply it to the command?
TIA
Mark