Reputation: 111
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
My SQL script will create a VIEW. When this view for example already exists I see an error in the BTEQ command window:
*** Failure 3804 View 'ViewName' already exists.
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.
Upvotes: 1
Views: 4218
Reputation: 51
Save all your script written above as a text file and create a batch file that generates a log after running the script:
echo off
bteq < script.txt > script.log 2>&1
@echo off goto end
:end
@echo exit
Errors will be recorded in this way.
Upvotes: 0
Reputation: 7786
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.
There is more information in the BTEQ manual under Chapter 5 - BTEQ Commands.
Upvotes: 1