Re: What's the best way to insert new records only
From: LP (lp_at_a.com)
Date: 02/14/05
- Next message: Cor Ligthert: "Re: What's the best way to insert new records only"
- Previous message: Paul Clement: "Re: Auto Number Seed ?"
- In reply to: Nick Malik [Microsoft]: "Re: What's the best way to insert new records only"
- Next in thread: Cor Ligthert: "Re: What's the best way to insert new records only"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 14 Feb 2005 11:54:16 -0500
Nick,
> Now, in the stored proc, take in the row parameters. Check if the row
> exists. If not, insert it.
I think that is the solution I was looking for!
I am really constrained by using our custom updater class. And I am aware
that DataAdapter inserts one record at a time, but it's a batch process that
runs overnight, so who cares.
But the good news is that this custom updater is exremly flexible; so
command is exposed as a property.
Thanks a lot.
"Nick Malik [Microsoft]" <nickmalik@hotmail.nospam.com> wrote in message
news:wuGdnUcKH5ZrWo3fRVn-tg@comcast.com...
> It's amazing how few people actually attempted to answer your question.
>
> Using a data adapter, you can specify any command you want to occur when a
> row is inserted. Specify that command as a stored procedure call in SQL.
> (Perfectly legal).
>
> Now, in the stored proc, take in the row parameters. Check if the row
> exists. If not, insert it.
>
> It really is that simple.
>
> --
> --- Nick Malik [Microsoft]
> MCSD, CFPS, Certified Scrummaster
> http://blogs.msdn.com/nickmalik
>
> Disclaimer: Opinions expressed in this forum are my own, and not
> representative of my employer.
> I do not answer questions on behalf of my employer. I'm just a
> programmer helping programmers.
> --
> "LP" <lp@a.com> wrote in message
> news:O5eUGPgEFHA.3732@TK2MSFTNGP14.phx.gbl...
> > Hi,
> >
> > Every morning a .NET application downloads a file with cumulative data
> > which
> > needs to be appended to SQL Server table. This program needs to identify
> > records that have not been previously inserted (there's a unique
> > identifier
> > field) and only insert those. Also I must reuse our class that does
> > updates,
> > it basically can update any table by using SqlDataAdapter .update
method.
> > So
> > I have to rule out bulk inserts, DTS, etc...
> > I think I have little choice but to load all records first to a "temp"
> > table
> > and then append only new records (where not exists) to a "real" table.
Can
> > anyone think of a better solution?
> >
> > Thank you.
> >
> >
>
>
- Next message: Cor Ligthert: "Re: What's the best way to insert new records only"
- Previous message: Paul Clement: "Re: Auto Number Seed ?"
- In reply to: Nick Malik [Microsoft]: "Re: What's the best way to insert new records only"
- Next in thread: Cor Ligthert: "Re: What's the best way to insert new records only"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|