Teradata Insert Multiple Rows

Teradata does not support traditional values with multiple rows while inserting data into the table. Instead of that, you can use Multi Statement Request(MSR).

Syntax

Insert into dbname.tblname values (value1, vlaue2)
;Insert into dbname.tblname values (value3, vlaue4)
;

Example

Let’s CREATE a Volatile table as below.

CREATE VOLATILE TABLE PRODUCT
(
ProductID Integer,
ProductName varchar(20),
Price Decimal (15,2)
) ON COMMIT PRESERVE ROWS;

We can use Teradata MSR statements to insert the data into the above volatile table.

INSERT INTO PRODUCT VALUES (1,'Common Salt', 32.25)
;INSERT INTO PRODUCT VALUES (2,'Glabaur Salt',34.50)
;INSERT INTO PRODUCT VALUES (3,'Caustic Soda',50.25)
;

If you are using Teradata SQL Assistant, you can execute the above insert statements using execute parallel button.

Now, you can see the data using the Teradata SELECT Statement.

Teradata Insert Multiple Rows

Leave a Comment