4

Is it possible to transfer the date from the Teradata Table into .csv file directly. Problem is - my table has more that 18 million rows. If yes, please send tell me the process

topchef
  • 19,091
  • 9
  • 63
  • 102
Adam
  • 2,347
  • 12
  • 55
  • 81

5 Answers5

3

For a table that size I would suggest using the FastExport utility. It does not natively support a CSV export but you can mimic the behavior.

Teradata SQL Assistant will export to a CSV but it would not be appropriate to use with a table of that size.

BTEQ is another alternative that may be acceptable for a one-time dump if the table.

Do you have access to any of these?

Rob Paller
  • 7,736
  • 29
  • 26
1

It's actually possible to change the delimiter of exported text files within Teradata SQL Assistant, without needing any separate applications:

Go to Tools > Options > Export/Import. From there, you can change the Use this delimiter between column option from {Tab} to ','.

You might also want to set the 'Enclose column data in' option to 'Double Quote', so that any commas in the data itself don't upset the file structure.

Export/Import Settings

From there, you use the regular text export: File > Export Results, run the query, and select one of the Delimited Text types.

File Type Selection

Then you can just use your operating system to manually change the file extension from .txt to .csv.

These instructions are from SQL Assistant version 16.20.0.7.

TheNeil
  • 3,321
  • 2
  • 27
  • 52
0

I use the following code to export data from the Teradata Table into .csv file directly.

CREATE EXTERNAL TABLE 
database_name.table_name (to be created) SAMEAS database_name.table_name (already existing, whose data is to be exported)
USING (DATAOBJECT ('C:\Data\file_name.csv')
DELIMITER '|' REMOTESOURCE 'ODBC');
nhahtdh
  • 55,989
  • 15
  • 126
  • 162
0

You can use FastExport utility from Teradata Studio for exporting the table in CSV format. You can define the delimiter as well.

FarIDM
  • 109
  • 6
0

Very simple.

Basic idea would be to export first table as a TXT file and then converting TXT t o CSV using R...read.table ()---> write.csv().....

Below are the steps of exporting TD table as txt file:

  • Select export option from file

enter image description here

  • Select all records from the table you want to export

enter image description here

  • Save it as a TXT file

enter image description here

Then use R to convert TXT file to CSV (set working directory to the location where you have saved your big TXT file):

my_table<-read.table("File_name.txt", fill = TRUE, header = TRUE)
write.csv(my_table,file = "File_name.csv")

This had worked for 15 million records table. Hope it helps.

Scott Grammilo
  • 1,229
  • 4
  • 16
  • 37
  • I don't know which release of SQL Assistant you're using, but there's a *Delimited Tex*t option in my version. And of course fastest way wuld be a simple TPT Export using DELIMITED format. – dnoeth Mar 08 '17 at 13:01