Wednesday, March 28, 2012

Put record in database.

Hello,
I have a database where each record has the following fields:
[id], [datetime], [name], [price]
I have an array with 1000 records which I need to save in the array.
When placing an array record, in the database, I need to check if there
is already one with the same datetime. If there is I want to replace the
name and price of that record. If there isn't I want to create a new
record.
Is this possible?
Thanks,
MiguelShapper,
I think you mean table?
I once wrote a simple DTS package to do what you're asking that replaced a
complex 8 page stored procedure using cursors. Took the op time from 20
hours to < 1 hour. I'd look at DTS for your UPDATE/INSERT.
HTH
Jerry
"Shapper" <mdmoura*NOSPAM*@.gmail.*DELETE2SEND*com> wrote in message
news:uVmnle00FHA.1032@.TK2MSFTNGP12.phx.gbl...
> Hello,
> I have a database where each record has the following fields:
> [id], [datetime], [name], [price]
> I have an array with 1000 records which I need to save in the array.
> When placing an array record, in the database, I need to check if there is
> already one with the same datetime. If there is I want to replace the name
> and price of that record. If there isn't I want to create a new record.
> Is this possible?
> Thanks,
> Miguel
>|||You will need to use an IF Exist condition. But what do you want to change
the name and price to?
"Shapper" wrote:

> Hello,
> I have a database where each record has the following fields:
> [id], [datetime], [name], [price]
> I have an array with 1000 records which I need to save in the array.
> When placing an array record, in the database, I need to check if there
> is already one with the same datetime. If there is I want to replace the
> name and price of that record. If there isn't I want to create a new
> record.
> Is this possible?
> Thanks,
> Miguel
>

No comments:

Post a Comment