Jeffrey Kramer
Jeffrey Kramer

Reputation: 1345

Teradata SQL export to csv

Is there a way to run a Teradata SQL query and then export the data to an external file?

For example, if I ran:

SELECT TOP 10
  *
FROM
  mydb.mytable

Could I write this in such a way that it will export to a CSV? Do I need to store my data in a temp table first and then do CREATE EXTERNAL TABLE? Any ideas would be appreciated - I've been returning data to R and then exporting, but there's no need for the intermediate step in some jobs.

Upvotes: 3

Views: 3795

Answers (1)

dnoeth
dnoeth

Reputation: 60513

There's no CREATE EXTERNAL TABLE in Teradata.

The only tool capable of exporting CSV directly is TPT (Teradata Parallel Transporter).

Otherwise you have to do the concat in your query using SELECT TRIM(col1) || ',' || TRIM(col2)... and then export based on your client's capabilities.

Upvotes: 3

Related Questions