- Set up Teradata to match the format of your text file
- To choose the delimiter:
- Under Tools → Options, go to Export/Import and select one of the options in 'Use this delimiter between columns', e.g. tab, comma, or pipe
- To skip the first row, e.g. a header line:
- Under Tools → Options, go to Import and select 'Ignore the first record in the import file (Skip Header)'
- Create the table in Teradata
- Run the command:
- CREATE TABLE <TableName> (<column1> <datatype>, <column2> <datatype>, ...) PRIMARY INDEX (<column1>);
- Import the file
- Go to File → Import Data
- Run the command:
- INSERT INTO <TableName> VALUES(?,?);
- where the number of ? matches the number of columns in your data file
- In the popup window, Open your file
- Unset Import mode by selecting File → Import Data
- Check that your table has loaded correctly
- Run the command:
- SELECT * FROM <TableName>;
Showing posts with label teradata. Show all posts
Showing posts with label teradata. Show all posts
Saturday, 14 January 2017
Importing CSV/TSV with Teradata SQL Assistant
Labels:
data science,
database,
sql,
teradata
Subscribe to:
Posts (Atom)