Grigory P
Grigory P

Reputation: 191

Teradata 5.1: Exporting table into csv/txt/xls with code

Is there any possibility in Teradata to export table into an external file with some lines of code instead of going to File->Export results manually? The idea is to make such export a part of procedure. The code might look like this:

Proc export;
data = library.table;
path = 'c:\folder\file.csv';

Thx

Upvotes: 0

Views: 2495

Answers (1)

ravioli
ravioli

Reputation: 3823

When you say "part of a procedure", are you saying part of a stored procedure or just a generic function/script? You can export table/SQL result data using Teradata's BTEQ utility, which can easily be scripted.

Sample BTEQ script

.logon <TDPID>/<user_name>,<password>

.export indicdata file=outputfile.dat
select * from MyTable;
.export reset;
.quit

You can also use Teradata's ARC tool to backup specific tables.

Upvotes: 3

Related Questions