You could make 2 scripts:

One that downloads the stats to your local db.
One that deletes the new records it finds in your local db from your remote
db, that way you're sure nothing gets deleted from the online/remote db
unless it really exists in your local db.

That's how I'd do it (not really fancy, I know...)

Piet.

> -----Original Message-----
> From: Robert Klemme [mailto:bob.news / gmx.net] 
> Sent: maandag 19 december 2005 11:58
> To: ruby-talk / ruby-lang.org
> Subject: Re: How do I do this in ruby?
> 
> 
> kishor.gurtu / gmail.com wrote:
> > Hi,
> >
> > I am trying to write a script that downloads my web server 
> statistics 
> > that is stored in an online MS SQL Database to a local database for 
> > further processing and then deletes the downloaded records (to save 
> > space online). How do I do this safely so that I don't lose any 
> > records due to network error - is there some kind of a distibuted 
> > transaction coordinator that I can use in ruby?
> 
> That question is probably better answered in a SQL Server 
> related news group.  This sounds like a typical application 
> of replication / staging. SQL Server does provide mechanisms 
> for that.  I'm sure you can even set a trigger that deletes 
> records after successful replication.  TX coordination can 
> also be done with SQL Server.  I can't help with the details 
> but I'm sure you'll find info in BOL (SQL Server Books Online).
> 
> Kind regards
> 
>     robert
> 
>