Importing data from excel using the insert statement

Database
N/A

Importing data from excel using the insert statement

I've created a volatile table and want to import a multiple field list into it from an excel file I have saved as delimited text. I've been succesful with a single field, but not multiple fields. The insert code I've used so far is as follows:
insert into cs.tag_table2 values(?)
I can manually do every row, but there's got to be a better way, right?
Any help is greatly appreciated...
6 REPLIES

Re: Importing data from excel using the insert statement

If you have the file in excel, you can create a column that uses the concatenate function to build your insert statements.

=concatenate("insert into cs.tag_table2 (field1, field2) values (",A1,",",B1,");"

Paste that down a column for each row. Then copy and paste the insert statements into queryman and run it like a script.

It's not exactly what you are asking for, but it's a quick trick to insert excel data into any database.
N/A

Re: Importing data from excel using the insert statement

Thanks for the help, that'll work! I'm still interested if anyone has a way to do it with one statement...
Teradata Employee

Re: Importing data from excel using the insert statement

Looking at this differently.

Try linking the excel spreadsheet to an access database. Link to your target table in teradata using ODBC.

Then create a insert data query in the query.

Its messy and not really a recommended way of doing it but it will work.

Re: Importing data from excel using the insert statement

The most common and used way of loading data to Teradata from a flat-file is through the load utilities.
You could write a Fastload or Multiload script and load the CSV formatted file with that.
N/A

Re: Importing data from excel using the insert statement

HI FRIENDS , 

CAN ANY BODY  GIVE SOME SYNTAX FOR THE INSERT STATEMENT BY PROMPT WITH NAME.

I TRIED THIS:

INSERT INTO "TABLE_1"

      (COURSE NUMBER,STUDENT NAME,SSN,STUDENT ID,ADDRESS)

     VALUES 

     (?,?,?,?,?);

AFTER EXECUTING THIS I GOT PROMPT WITH 5 COLUMNS , BUT WITH OUT THE NAME OF THE COLUMNS.     LIKE PARAMETER , NULL , DATATYPE , VALUE , SPECIFIC FILE , INPUT/OUTPUT

BUT CAN ANY ONE GIVE ME HOW TO GET NAMES OF THE PARAMETER IN THE PROMPT

Re: Importing data from excel using the insert statement

You can use the following syntax:

INSERT INTO  TABLENAME (COL1, COL2)
VALUES(?COL1,?COL2);
Khurram