>>Set @BulkCmd = 'Bulk Insert qryICECLImport from ' + @filename + ' with (FieldTerminator = '','', RowTerminator = ''\n'')' >>>>
declare @filename nvarchar(50), @BulkCmd nvarchar(200) Set @filename = 'c:\download\dropbox\cat\qryICECLExport.csv' set @BulkCmd = 'Bulk Insert qryICECLExport from ' + '' + @filename + '' + ' with (FieldTerminator = '','', RowTerminator = ''\n'')' print @BulkCmd exec(@BulkCmd) ** and the messages I get when I execute the above block Bulk Insert qryICECLExport from c:\download\dropbox\cat\qryICECLExport.csv with (FieldTerminator = ',', RowTerminator = '\n') Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'c:'. Msg 319, Level 15, State 1, Line 2 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.The only thing I'm seeing that's probably not correct is that there should be quotes around the c:\.... I've tried
Set @FileName = '' + 'c:\...csv' + ''but that doesn't put the quotes around it either.