Board index » delphi » SQL Server Update problems (?)

SQL Server Update problems (?)

Here's what might be a stupid question, but here goes:

If a multithreaded app has two threads, each applying SQL updates to
the same table simultaneously but using separate sessions, are there
any problems that can possibly arise?  Or should this be entirely
safe?

Thanks,
   Steve

Steve Magruder, Technocrat
Join the Technopoly list:
http://www.onelist.com/subscribe/Technopoly

 

Re:SQL Server Update problems (?)


Depends how you get your primary key. If the key is server generated then it
should be safe. Or if you know for certain that your application isn't going
to try duplicating your keys you shouldn't have a problem.

Quote
Steve Magruder <smagru...@blueangelgroup.com> wrote in message

news:379c9eb5.182752982@forums.inprise.com...
Quote
> Here's what might be a stupid question, but here goes:

> If a multithreaded app has two threads, each applying SQL updates to
> the same table simultaneously but using separate sessions, are there
> any problems that can possibly arise?  Or should this be entirely
> safe?

> Thanks,
>    Steve

> Steve Magruder, Technocrat
> Join the Technopoly list:
> http://www.onelist.com/subscribe/Technopoly

Re:SQL Server Update problems (?)


The primary key is generated by the server in terms of the first field
of the key, which is really an identify field from another table
(foreign key).  I use a stored procedure to join this foreign key'ed
identity field with a second field that is supplied as a parameter.
This stored procedure handles inserting and updating to this table,
depending upon whether the record already exists or not.

I have one potential instance of this stored procedure "competing"
against potentially multiple passed-thru SQL Update statements
updating fields of the same table that's updated in the stored
procedure.  And they're all using separate sessions in separate
threads.

On Mon, 26 Jul 1999 14:07:30 -0400, "Andy B."

Quote
<bbarr...@nospamusit.net> wrote:
>Depends how you get your primary key. If the key is server generated then it
>should be safe. Or if you know for certain that your application isn't going
>to try duplicating your keys you shouldn't have a problem.

>Steve Magruder <smagru...@blueangelgroup.com> wrote in message
>news:379c9eb5.182752982@forums.inprise.com...
>> Here's what might be a stupid question, but here goes:

>> If a multithreaded app has two threads, each applying SQL updates to
>> the same table simultaneously but using separate sessions, are there
>> any problems that can possibly arise?  Or should this be entirely
>> safe?

>> Thanks,
>>    Steve

>> Steve Magruder, Technocrat
>> Join the Technopoly list:
>> http://www.onelist.com/subscribe/Technopoly

Steve Magruder, Technocrat
------
Having a Bad Technology Day?
Join the 'Technopoly' List:
http://www.onelist.com/subscribe/Technopoly

Other Threads