![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a need to use some pieces of a SQL Recordset and combine those with each filename in a folder. I then need to output each of those combinations to a file. I know I can do a FOR loop to get all filenames in a folder and I can get the information from SQL without any issues. My lack of knowledge here is in how to combine the two. Anyone done this before? Any ideas on how to get started? Examples: C:\MyFolder\ 1.jpg 2.jpg 3.jpg Desired output recordset: Folder, OriginalFileName, NewFileName, Constant1, Constant2 C:\MyFolder, 1.jpg, 001.jpg, 12345, 54321 C:\MyFolder, 2.jpg, 002.jpg, 12345, 54321 C:\MyFolder, 3.jpg, 003.jpg, 12345, 54321 TIA. -Pete |
#3
| |||
| |||
|
|
So you want to go through a folder which you know so will be held in a GV You want to loop through the files in that directory You want to add 2 * constants Your destination I can only presume has 4 attributes Here's an idea Loop over the files in the directory read the name of the file into a global variable. using an ExecuteSQL task load the GV into a table Now for the sending to the destination Create a datapump between the "file name" table and your destination. That will leave 3 attributes on the destination to be populated. In the transformations tab select those three destination columns and create a new active script transform. In there it will look something like DTSDestination("Column 1") = DTSGlobalVariables("Name of file").Value DTSDestination("Column 2") = "Constant 1" DTSDestination("Column 3") = "Constant 2" |
![]() |
| Thread Tools | |
| Display Modes | |
| |