Question : Checking Value of Import Text File

I am using SSIS 2005 to consume a delimited text file that will be transfered to a SQL 2008 table. Before or while I upload the text file, I want to check the value in the first column of the first record (Or any record really. The value will be the same for all records). If the value doesn't match what I am looking for, I want to notify the user & not consume the file.

I know I can do this in an activeX script using streamreader, but I want to know if there is another way to handle this in SSIS. It seems like there should be & I'd like to know as much about SSIS as possible instead of reverting back to old tricks to get the job done.  

Answer : Checking Value of Import Text File

Hi

You can use script task and write some dotnet code as below


            connectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + importFolder + ";"
            conn = New Odbc.OdbcConnection(connectionString)

            da = New System.Data.Odbc.OdbcDataAdapter("select * from [" + fileName + "]", conn)
            da.Fill(dt)

you can query the dataset table and get your value and save to a variable
Then run the next task on this value
Random Solutions  
 
programming4us programming4us