问题描述
我的目标是通过 BTEQ 自动将 SQL 脚本部署到 Teradata.到目前为止,我的脚本正在运行.但是,我想生成一个日志文件来捕获可能的故障.
My goal is to automate a deployment of SQL scripts to Teradata via BTEQ. So far my script is working. However, I would like to generate a log file where possible failures are captured.
.LOGON tdserver/username,pw
.EXPORT file=\logfile.txt;
.run file = \Desktop\test\test.sql;
.LOGOFF
.EXIT
我的 SQL 脚本将创建一个视图.例如,当此视图已存在时,我会在 BTEQ 命令窗口中看到错误:
My SQL script will create a VIEW. When this view for example already exists I see an error in the BTEQ command window:
*** 失败 3804 View 'ViewName' 已经存在.
*** Failure 3804 View 'ViewName' already exists.
我希望在我的日志文件中包含此 TD 消息.我尝试了几次,一直在寻找 3 个小时,但不幸的是没有成功.
I would like to have this TD Message in my log file. I tried several tings, have been looking for 3 hours but unfortunately without success.
推荐答案
您可能想尝试使用 .SET ERROROUT STDERR
将错误流重新路由到 STDERR 输出文件而不是默认值将错误流路由到 STDOUT 的操作.
You may want to experiment using .SET ERROROUT STDERR
which re-routes the error stream to the STDERR output file instead of the default action of routing the error stream to STDOUT.
BTEQ 手册的第 5 章 - BTEQ 命令中有更多信息.
There is more information in the BTEQ manual under Chapter 5 - BTEQ Commands.
这篇关于BTEQ:在日志文件中保存 Teradata 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!