DTS and Active X

  • I'm writing a DTS to import a comma delimited file. Unfortunately not all the records have the correct number of columns. How can I check the number of columns and skip the incorrect ones?

    Ta

  • You will have to hand parse it with ActiveX by opening each line from the file and verifying the conditions that make it a valid record, split it and post to database. I have no code I can provide at this time, hopefully someone will post an example.

  • In SQL7 DTS, if you use a test file with the maximum number of columns and define the properties of the file, then when you use real data file, sql will import the data irrespective of the number of columns specified (as long as each line is terminated correctly) and will insert null where no column is specified. You can then check the data for null columns.

    Obviously this will only work if you have no empty columns in the 'valid' data.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • I do this in SQL 2000...then simply do a delete query on my table right after the records are imported, removing those records where the end columns are null.

    Michael Weiss


    Michael Weiss

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply