如何编写批处理 (*.bat) 脚本来使用 BTEQ 执行 Teradata 查询?
以下是我的 script.bat 的内容:
@echo off
cd C:\Program Files\Teradata\Client\13.0\bin
bteq .LOGON server/username,password;
select date;
.LOGOFF
@echo off goto end
:end @echo exit
我登录没有问题,但似乎 bteq 无法读取我的查询语句:
选择日期;
它不断提示输入。谁能帮助我让 bteq 读取并执行查询语句?
我已经尝试过在线有关输入和输出文件的解决方案:
bteq <myscript.txt> mylog.log
但它也不起作用。
Below is the content of my script.bat :
@echo off
cd C:\Program Files\Teradata\Client\13.0\bin
bteq .LOGON server/username,password;
select date;
.LOGOFF
@echo off goto end
:end @echo exit
I have no problem with the logon, but it seems that bteq can't read my query statement:
select date;
It keeps prompting for input. Can anyone help me to get bteq to read and execute the query statement?
I've tried the solutions online about input and output file:
bteq <myscript.txt> mylog.log
but it didn't work either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将需要两个文件,一个是批处理文件,另一个是命令。
批处理文件:
命令:
编辑:
删除了
.LOGON...
后的分号You are going to need two files, one is a batch and the other one are the commands.
Batch file:
Commands:
EDIT:
Removed semicolon after
.LOGON...
这有点晚了,但这是我发现的:
我将 BTEQ 脚本保存在名为 BTScript.txt 的文件中:
需要设置宽度以防止数据被截断,如果记录没那么长。
要运行此程序,我在 .bat 文件上执行(我的电脑设置为允许我在 Windows 资源管理器中双击该文件来执行此操作),其内容为:
这里提到的第二个文件将包含 BTEQ 的输出。
This is a bit late, but here is what I've found:
I save my BTEQ script in a file called BTScript.txt:
The setting of width is needed to prevent the data being truncated, it will not go to 20000 chars if the record isnt that long.
To run this I execute (my pc is set up to allow me to double click on the file in windows explorer to do this) on a .bat file the content of which are:
The second file referred to here will contain the output from BTEQ.