Taggs Posted January 6, 2010 Share Posted January 6, 2010 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 Link to comment Share on other sites More sharing options...
gunsmokingman Posted January 7, 2010 Share Posted January 7, 2010 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_' Link to comment Share on other sites More sharing options...
Taggs Posted January 8, 2010 Author Share Posted January 8, 2010 Hi gunsmokingman,Thanks for that but unfortunately I have already tried that but to no avail. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now