1

我使用以下语法将表从 Teradata Aster 导出到 csv 文件中:

\o file_name.csv
COPY table_name TO STDOUT WITH DELIMITER ',';
\o
\install file_name.csv

此代码使用从 Aster 表中导出的数据创建一个 csv。但是,它不包含标题行。数据足够大,无法通过 Teradata Studio Express 导出。目前,我的解决方案是在文本编辑器 post 中手动插入标题COPY。我想知道是否有办法在实际中做到这一点?

4

1 回答 1

0

首次登录 ACT 时,您会看到一个欢迎屏幕:

Welcome to act 06.00.00.02, the Aster nCluster Terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with act commands
       \g or terminate with semicolon to execute query
       \q to quit

您可以使用为您的功能\h COPY查找文档。COPY像这样:

Command:     COPY
Description: copy data between a file and a table
Syntax:
COPY tablename [ ( column [, ...] ) ]
    FROM STDIN
    [ [ WITH ]
          [ DELIMITER [ AS ] 'delimiter' ]
          [ NULL [ AS ] 'null string' ]
          [ CSV [ QUOTE [ AS ] 'quote' ]
                [ ESCAPE [ AS ] 'escape' ] ] ]
    [ LOG ERRORS
      [ [ INTO errortablename ] [ WITH LABEL [ AS ] 'label' ] | NOWHERE ]
      [ ERRORLIMIT [ AS ] limit ]
    ]

COPY tablename [ ( column [, ...] ) ]
    TO STDOUT
    [ [ WITH ]
          [ DELIMITER [ AS ] 'delimiter' ]
          [ NULL [ AS ] 'null string' ]
          [ CSV [ QUOTE [ AS ] 'quote' ]
                [ ESCAPE [ AS ] 'escape' ] ] ]

这里没有使用标题复制的选项。因此,我认为您可能必须在复制后重新添加标题。

于 2016-04-15T23:16:32.127 回答