This will be faster than using multiple Insert statements.
INSERT INTO MyTable ( Column1, Column2 ) 
VALUES
  ( Value1, Value2 ), 
  ( Value1, Value2 );
-- Ex:
INSERT INTO tblPerson (First,Last) 
VALUES 
  ('Fred','Smith'),
  ('John','Smith'),
  ('Michael','Smith'),
  ('Robert','Smith');
-- If data is from another table
INSERT INTO table1 ( col1, col2, col3, col4 )
SELECT  table2.column1, table2.column2, 8, 'some string etc.'
FROM    table2
WHERE   table2.ID = 7;
 
No comments:
Post a Comment