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

  1. Set up Teradata to match the format of your text file
    1. 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
    2. 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)'
  2. Create the table in Teradata
    1. Run the command:
      • CREATE TABLE <TableName> (<column1> <datatype>, <column2> <datatype>, ...) PRIMARY INDEX (<column1>);
  3. Import the file
    1. Go to File → Import Data
    2. Run the command:
      • INSERT INTO <TableName> VALUES(?,?);
    3. where the number of ? matches the number of columns in your data file
    4. In the popup window, Open your file
    5. Unset Import mode by selecting File → Import Data
  4. Check that your table has loaded correctly
    1. Run the command:
      • SELECT * FROM <TableName>;