All Forums Database
csaal 3 posts Joined 05/06
22 May 2006
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...

Nytewynd 13 posts Joined 12/05
23 May 2006

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.

csaal 3 posts Joined 05/06
23 May 2006

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

simon.chandler 2 posts Joined 10/05
23 May 2006

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.

DGiabbai 47 posts Joined 07/04
24 May 2006

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.

rama35 2 posts Joined 08/13
20 Sep 2013

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

 

M.Saeed Khurram 544 posts Joined 09/12
21 Sep 2013

You can use the following syntax:

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

 

Khurram

You must sign in to leave a comment.