Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Best approach to waiting for a file

$
0
0

I've built a "listener" job that runs a stored procedure every 15 minutes to see if a file has landed in an import directory. There are several files from different sources, and they can come in at any time of the day. The listener goes through a table of filenames using a cursor, then checks to see if each file exists using xp_cmdShell...

SET @Command = 'Dir "' + @FromFile + '"';
EXEC @xpRetVal = master.dbo.xp_cmdshell @Command, NO_OUTPUT

If it exists, the table contains the name of a stored procedure that will then import and process the file. The file is moved into an archive when that's complete.

My listener code works fine as far as finding a file that's in the directory. What I'm wondering is how do I know if the file has completely landed before I start importing it. Is there a way to tell?


Darrell H Burns



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>