import csv files with changing name into sql server 2008
I'm new with this tool so i need some help, the problem is that i need to insert several csv file into diferent tables in sql server 2008 but here is the question the csv files have the name like this TableNameddmmyyyy.csv so i need to upload the file in 'Table Name' if the file wasn't uploaded, and this process will execute ever last day of the month.
May 28th, 2012 1:21pm

See this blog post: http://www.sqlservercentral.com/articles/Integration+Services+%28SSIS%29/67871/ It is pretty much what you need to start off. You may need a SSIS Expression to trim off the table name part of the file. Looks like it will be current date based, so you can do it like: take the current date in ddmmyyyy format and in the expression do REPLACE (REPLACE ([User::Filename], [User::DatePart]), ".csv") to get the table name I need some clarification regarding "if the file wasn't uploaded", do you mean it was expected and not found? Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2012 1:33pm

Thanks for the answer, about "if the file wasn't uploaded" it means that if i already insert the content in a table, not insert it again
May 28th, 2012 2:19pm

Then you need to add a check against the file names added. This can be done using an Execute SQL Task to query on file names processed against the current one, then use a Precedence Constraint to direct the package execution to a either loading or skipping this file. Example: http://www.bidn.com/blogs/mikedavis/ssis/559/ssis-skip-certain-files-in-a-for-each-loopArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2012 2:22pm

Then you need to add a check against the file names added. This can be done using an Execute SQL Task to query on file names processed against the current one, then use a Precedence Constraint to direct the package execution to a either loading or skipping this file. Example: http://www.bidn.com/blogs/mikedavis/ssis/559/ssis-skip-certain-files-in-a-for-each-loopArthur My Blog
May 28th, 2012 2:22pm

Hi , There is one more solution for this. You can use a vb script to generate the file name and assign it to a variable and in the Data source you can use this varaible to specify the file name.
Free Windows Admin Tool Kit Click here and download it now
May 29th, 2012 5:56am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics