dbTalk Databases Forums  

reading a text file as it is written

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss reading a text file as it is written in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Greg Stigers, MCSA
 
Posts: n/a

Default reading a text file as it is written - 01-20-2005 , 05:50 PM






A remote office developed a PC-based app that writes its data to a text
file. We want to maintain this data at the main office, and in SQL Server,
due to the significance of the data. A typical day's file may have a couple
hundred records, written over an eight hour shift. Rather than changing the
application to connect to our SQL Server, and worrying about network
connectivity and impact on productivity, is there a reasonable means to have
SQL Server detect when this text file is updated, and add the most current
record(s) to our SQL Server table? Please also reply to my email address,
gregstigers (AT) spamcop (DOT) net. Thanks.
--
Greg Stigers, MCSA
remember to vote for the answers you like



Reply With Quote
  #2  
Old   
John Gallardo [MSFT]
 
Posts: n/a

Default Re: reading a text file as it is written - 01-27-2005 , 07:41 PM






NT has file change notifications. You can write some C# to receive these
notifications and then kick off the script which updates the database.
Check out System.IO.FileSystemWatcher
(http://msdn.microsoft.com/library/de...classtopic.asp)

However, reading the file while it is still open and being written to is
tricky... it actually depends on how the application doing the writing
opened the file. It can specify whether it wants to allow people to read it
while it is being written. If it said that it doesn't want to share with
anybody, then there isn't much you can do other than change that
application.

--
John Gallardo
SQL Server Engine
Microsoft Corp
[This posting is provided "AS IS" with no warranties, and confers no
rights.]

"Greg Stigers, MCSA" <gregstigers+wmsn (AT) spamcop (DOT) net> wrote

Quote:
A remote office developed a PC-based app that writes its data to a text
file. We want to maintain this data at the main office, and in SQL Server,
due to the significance of the data. A typical day's file may have a couple
hundred records, written over an eight hour shift. Rather than changing the
application to connect to our SQL Server, and worrying about network
connectivity and impact on productivity, is there a reasonable means to
have SQL Server detect when this text file is updated, and add the most
current record(s) to our SQL Server table? Please also reply to my email
address, gregstigers (AT) spamcop (DOT) net. Thanks.
--
Greg Stigers, MCSA
remember to vote for the answers you like




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.