0

i am reading records data from a file(records count can be up to thousands ).Now i want to insert each record in to database.I want to insert all of records in one hit to reduce performance hit. If i use addBatch(String sqlQuery ) on statment object,my sql query should be static .but in my case query will be non static.Please tell me possible solutions with best performance?

platform java 1.4 sql server 2000.

Maddy.Shik
  • 6,609
  • 18
  • 69
  • 98

1 Answers1

1

From Wiki

A SQL feature (since SQL-92) is the use of row value constructors to insert multiple rows at a time in a single SQL statement:

INSERT INTO ''TABLE'' (''column1'', [''column2, ... '']) 
VALUES (''value1a'', [''value1b, ...'']), 
       (''value2a'', [''value2b, ...'']), 
   ...
o.k.w
  • 25,490
  • 6
  • 66
  • 63
  • thanks.in this case,i will have to generate my sql query dynamically depending upon number of records.If there is some better solution,pls tell? – Maddy.Shik Oct 24 '09 at 11:02
  • What error do you get? If I'm not wrong, MSSQL2000 should be SQL-92 compliant. – o.k.w Oct 24 '09 at 11:21