File checksum

  • I work on a script, which will import data from a flat file. The file will be manually placed into a network directory each day. A scheduled job will trigger a DTS package and import data from this file. How can I run file checksum from a DTS package to make sure that this is not a duplicate file? Maybe there are some other ways of identifying a duplicate file, using SQL Server 2000?

     

    Thanks,

    a subscriber.

  • Take a look at the filesystem object. You can retrieve the date and time that the file was created or modified.

    That way you can store this in a table and check the max from the table is not the same as the current.

    Just use activex script in the package to accomplish. Search sqldts.com for filesystemobject. Some great, easy to follow examples.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • Would it be possible to use the data to verify duplicates?  Is there a field (or several fields together) that could comprise a primary key?

    An obvious solution, I know, but I bring it up because I work with a process where the import from a text file is manual.  A while back, we had some problems with the import, causing some of the text to be imported but not all of it.  After we fixed the problem, we were able to simply re-run all the imports - all the data that wasn't currently in the system got added, and the duplicates weren't imported, they just spit out a duplicate message along with the PK to a log file.

     


    Two muffins are sitting in an oven. The first one turns to the second and says "pretty hot in here, huh?"
    The second muffin glances at the first and then shrieks in fear,
    "AAAAAAHH!!! A TALKING MUFFIN!!!"

  • Thank you for your replies. I would have to get myself familiar with "filesystemobject". I just know that some programming languages have the ability to create the file checksum, which uniquely identifies the file. It is a single parameter and you don't need to worry about parsing the file or about checking the file properties.

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

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