I am currently trying to import a text file into sql server. I am using SQL server 2000 DTS to read in the file. I then want to add an active X transformation task to split the file into multiple files which will then be uploaded into separate sql tables. I am using 2 active x tasks, one tocheck if the file exists and the other to split the file. The script I use to check for the file is as follows:
I would like to amend this script to first check for the file. Once it has found the file read it and look for a line containing "[ownership]". Once it find this it should check if the next line is blank. If not add a blank line and complete the script. If the next line is a blank then complete the script. Any ideas?
Code:
Option Explicit
Function Main()
Dim oFSO, sFileName
' Get the name of the file from the Connection "Text File (Source)"
sFilename = DTSGlobalVariables.Parent.Connections("Text File (Source)").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Check for file and return appropriate result
If oFSO.FileExists(sFilename) Then
Main = DTSTaskExecResult_Success
Else
MsgBox "The " & sFilename & " does not exists"
Main = DTSTaskExecResult_Failure
End If
Set oFSO = Nothing
End Function
I would like to amend this script to first check for the file. Once it has found the file read it and look for a line containing "[ownership]". Once it find this it should check if the next line is blank. If not add a blank line and complete the script. If the next line is a blank then complete the script. Any ideas?