multiple inserts in one statement

Database

multiple inserts in one statement

Currently we are using a statement like below in SQL Server and is working fine

insert into table1 (First,Last)
values ("Fred","Smith"),
("John","Smith"),
("Michael","Smith"),
("Robert","Smith");

When we moved to Teradata the above statement is not working. Is there a way to do the above task with out using multiple insert statements and the values are coming from a different source but not a table
3 REPLIES
Junior Supporter

Re: multiple inserts in one statement

The syntax referred is not ANSI.

You can build a text file with the values to insert and use .IMPORT in bteq or any other tool.

HTH.

Cheers.

Carlos.
Enthusiast

Re: multiple inserts in one statement

->save the values in a text file and import it into SQL Assistant.

->u can insert no.of rows of any other table by using single insert statement

insert into table_name1(col1,col2) sel col1,col2 from table_name2;

use where clause to restrict rows
Junior Contributor

Re: multiple inserts in one statement

Hi Carlos,
of course this is Standard SQL, it's a "row value constructor" :-)

Dieter