Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ph1long
Starting Member
16 Posts |
Posted - 2013-01-03 : 15:50:06
|
Hi,
I have filenames such as:
FD3_2012-10_Stmt.pdf FD6_2012-10_Stmt.pdf AAA_2012-10_Stmt.pdf
listed in a table called "Reports".
Is there a way to:
1. Create (X) number of random folder names in a table ("X" depends on how many file names I have in the table. 2. Use these names to create folders on the C: drive. 3. Place the files in their corresponding folders?
Thanks |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-01-03 : 17:24:20
|
I assume you are asking for a programmatic solution?
1. sounds like you simply want to add rows in one table based on the rows in another table? That is easy with t-sql.
2 and 3. These both involve interaction with the file system. The best way to do that is with either application code (ie .net app) or with integrated code solution (ie CLR). .net has Class libraries with functionality to perform these typs of things. (ie System.IO.FileInfo)
Be One with the Optimizer TG |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-04 : 02:55:39
|
1 same as what TG suggested 2 and 3 you could use File System Task available in SSIS to create folders. the looping can be implemented by means of ForEachLoop task. Also files can be moved using Move File functionality in SSIS
Sample packages using File System Task and ForEachLoop can be found here
http://visakhm.blogspot.in/2012/12/selective-file-archiving-using-ssis.html
http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
|
|