• Post Reply Bookmark Topic Watch Topic
  • New Topic

most efficient way to insert records in a DB

 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

I'm using the PreparedStatements's executeUpdate method. But sometimes there are blockings that occur in SQLServer that prevent the record from being inserted...

What is the most efficient way of inserting records in MS SQL 2000?
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you updating records or inserting?
 
Scott Selikoff
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Order your all of you inserts/updates in a single transaction to always update all tables in a specific order (for example, always update table A before table B, table B before table c, etc for all transactions). This prevents locking due to cycles.

Many times though, such ordering is difficult to implement.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!