Wednesday, March 28, 2012

Multi Record Insert

Hi,
This works:
INSERT INTO test (valueField) VALUES (1);
This does NOT:
INSERT INTO test (valueField) VALUES (1),(2),(3);
Why and how do i make it work? i want to insert multiple records with one
insert statement.. if i insert each one seperately then it takes too long..
i guess i could use transaction locking... but isn't there an easy (aNSI
compatible) way of inserting many records quickly with as few statements as
possible?
I am trying to compare MySQL 4.1 and 5 to SQL Server 2005 and i would most
like to have SQL statements that work in both.
Thanks for any help!
Ok i am have to create a program that per SQL over ODBC is compatible with
different DBMS's. Qurrently i have a proUse INSERT...SELECT:
insert <table>
(
<column>
)
select <column>
union all
select <column>
union all
select <column>
..
ML
http://milambda.blogspot.com/

No comments:

Post a Comment