January 6, 201016 yr Hi Guys, I'm trying to perform an automated bulk insert of a file each day, which contains the date in the file name. If I enter the file name it runs fine so I think it is just the formatting of the code/string but I am struggling to find what it can be (if at all possible). The code extract is BULK Insert HDD_Info_temp from 'c:\support\bulkimport\HDD-REPORT-SUCCESS_' + (select convert(varchar,(CAST(CONVERT(varchar, GetDate(), 105) AS DateTime)),105)) + '-09-17-00.csv'with (fieldterminator = ',',rowterminator ='\n')gothe error I get isServer: Msg 170, Level 15, State 1, Line 2Line 2: Incorrect syntax near '+'.Server: Msg 170, Level 15, State 1, Line 2Line 2: Incorrect syntax near '+'.if I run the statement select ('c:\support\bulkimport\HDD-REPORT-SUCCESS_' + (select convert(varchar,(CAST(CONVERT(varchar, GetDate(), 105) AS DateTime)),105)) + '-09-17-00.csv')I get the required stringAny idea's or is it not possible via TSQLTaggs
January 7, 201016 yr Since I do not know this langauge so this is just a guess. I dont know if it matter but the working codehas a select ( at the beggining. The non working does not have select ( at the beggining. Not working codefrom 'c:\support\bulkimport\HDD-REPORT-SUCCESS_'Working Codeselect ('c:\support\bulkimport\HDD-REPORT-SUCCESS_'
January 8, 201016 yr Author Hi gunsmokingman,Thanks for that but unfortunately I have already tried that but to no avail.
Create an account or sign in to comment