0

这是我的简单 BTEQ 脚本

.LOGON 127.0.0.1/tduser,tduser
.EXPORT DATA FILE=C:\Documents and Settings\Owner\Desktop\Study\Google Drive\TD\BTEQ\Exported_File.txt
    SELECT      account_number
    FROM    samples.accounts
    WHERE   balance_current  < 500 ;
.EXPORT RESET
.QUIT

==================================================== ====================================

脚本的输出:

BTEQ 12.00.00.01 Tue Mar 26 19:58:59 2013

+---------+---------+---------+---------+---------+---------+---------+----
.LOGON 127.0.0.1/tduser,

 *** Logon successfully completed.
 *** Teradata Database Release is 12.00.00.10
 *** Teradata Database Version is 12.00.00.10
 *** Transaction Semantics are BTET.
 *** Character Set Name is 'ASCII'.

 *** Total elapsed time was 1 second.

+---------+---------+---------+---------+---------+---------+---------+----
.EXPORT DATA FILE=C:\Documents and Settings\Owner\Desktop\Study\Google Driv
e\TD\BTEQ\Exported_File.txt
 *** To reset export, type .EXPORT RESET
+---------+---------+---------+---------+---------+---------+---------+----
 SELECT   account_number
 FROM  samples.accounts
 WHERE  balance_current  < 500 ;

 *** Success, Stmt# 1 ActivityCount = 4
 *** Query completed. 4 rows found. One column returned.
 *** Total elapsed time was 1 second.


+---------+---------+---------+---------+---------+---------+---------+----
.EXPORT RESET
 *** Output returned to console.
+---------+---------+---------+---------+---------+---------+---------+----
.QUIT
 *** You are now logged off from the DBC.
 *** Exiting BTEQ...
 *** RC (return code) = 0

==================================================== ====================================

有一次,我检查了它在文本文件中显示无效字符的文件。任何可能的解决方法?统一码问题?我不确定。我什至尝试在下面粘贴文件内容,但它是空的。


提前致谢。

4

3 回答 3

1

请使用以下命令在 bteq 中导出:

.EXPORT 报告文件=文件名...

我在数据文件中遇到了同样的问题。更改为 this 后,它起作用了。

于 2015-11-27T08:59:06.120 回答
0

由于实际文件的路径中有空格,请尝试用双引号将您的文件名括起来。

原来的

.EXPORT DATA FILE=C:\Documents and Settings\Owner\Desktop\Study\Google Drive\TD\BTEQ\Exported_File.txt

修改

.EXPORT DATA FILE="C:\Documents and Settings\Owner\Desktop\Study\Google Drive\TD\BTEQ\Exported_File.txt"
于 2013-04-10T15:05:50.683 回答
-1

改变如下..

.EXPORT 报告文件=文件名...

于 2013-04-09T17:18:07.940 回答