My code below is throwing errors (at bottom) but I don't know what the problem is. I'm just passing this procedure a string to concatenate onto the end of the directory in the FROM clause. Before I added the concatenation, the syntax checked out fine. I'm sure it's a pretty basic mistake. I don't do bulk inserts very often. Any help is appreciated.
create procedure spWPLoadDataFile24(@FileName varchar(200))
as
BULK
INSERT tblWPdatafile24_Staging
FROM '\\Gmc0190\data\WelcomePacketData\cpnom\' + @FileName
WITH
(
FIELDTERMINATOR = '|',
ROWTERMINATOR = '\n'
)
GO
Msg 102, Level 15, State 1, Procedure spWPLoadDataFile24, Line 8
Incorrect syntax near '+'.
Msg 319, Level 15, State 1, Procedure spWPLoadDataFile24, Line 9
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.