July 7, 2004 at 6:25 am
I want to be able to parse through a flat file and extract certain rows, using specific numeric "keywords" to find the correct rows, then extract these to a separate text file. Is this possible with DTS?
July 7, 2004 at 7:14 am
Yes but why. Use FINDSTR.
But if you do want to use DTS then
Create two tables using Execute SQL Task
Transform the text file (Source) to first table
Insert into second table rows required using Execute SQL Task
Transform the second table to text file (Destination)
Drop the two tables using Execute SQL Task
Far away is close at hand in the images of elsewhere.
Anon.
July 7, 2004 at 7:19 am
Pardon my ignorance, but what's FINDSTR?
July 7, 2004 at 7:25 am
Hi,
Create a ActiveX Script Task with the following code to open and parse a file from a folder.
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(strSource & "\" & strJobFileName) Then
Set objfile = filesys.GetFile(strSource & "\" & strJobFileName)
Set ftsInput = objfile.OpenAsTextStream(ForReading,TristateUseDefault)
Do While Not ftsInput.AtEndOfStream
strLine = ftsInput.ReadLine
....
'search for the specified string and then write it to another file...
loop
End if
Hope this help!!!
July 7, 2004 at 7:40 am
nice on kailash, good solution.
FINDSTR is a DOS command for finding text in a file.
If you goto 'Command Prompt' (Satrt/Programs/Accessories) and type in
FINDSTR /?
you will see all the parameters available.
Far away is close at hand in the images of elsewhere.
Anon.
July 7, 2004 at 10:39 am
Thanks, I think the ActiveX script sounds like it will work!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply