Linked Server to Text Files: is possible to detect changes made to those files? (SQL Server 2005)

  • Hi gurus,

    I've created a linked server (and set up the corresponding schema.ini file) in order to perform bulk-inserts from some CSV text files into SQL tables (from my standpoint the text files are just for reading purposes). The linked server works fine (I can select the data in the files without a problem).

    Now the question: is possible to automatically detect when one or more of those files change in order to start the import process automatically?  Something like having a trigger created on the CSV files       Or there's no easy way to do that so I have, to say something, to create a Job that periodically checks if the files have changed programatically (say, recording each file's timestamp everytime is imported and comparing the recorded value with the current one, or whatever)?   

    Thanks a lot in advance!

  • You could set up a check for the file timestamp with a script of some sort. In SQL 2000, I'd probably set a DTS package that uses VBScript to check the timestamp against some value, maybe store the last timestamp into a table somewhere.

    The FileSystemObject in VBScript is a good place to start in getting information about a file. I'd use the Dynamic Properties Task so that I can get the last timestamp as the last time this ran. I'd also be sure you stored that value in the table.

Viewing 2 posts - 1 through 2 (of 2 total)

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