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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 search text of a file for a string in ssis script

Author  Topic 

sarahmfr
Posting Yak Master

214 Posts

Posted - 2011-07-29 : 00:51:48
I am new to script tasks in ssis
I have a list of files in a directory.
I want to go through the files and search for the following words
word1,word2,word3 inside the file
if the file has the word word1 i want to move it to a folder named word1 if the file has the word word2 i want ot move it to folder named word2

How can I do that using ssis
Thanks in advance


sarah

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-29 : 02:41:22
you need to use foreachloop for looping through the files
you need to add a script task inside for each loop to open file and read contents. based on what word it has you need to set value of ssis variable created with word1 or word2 or word3. then add a file system task for copy file and give destination folder name as above variable name.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sarahmfr
Posting Yak Master

214 Posts

Posted - 2011-07-30 : 16:30:54
Thanks I will try that
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-31 : 01:48:16
good luck. post back if you face any problem

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -