BTEQ script in BAT file

General
General covers Articles, Reference documentation, FAQs, Downloads and Blogs that do not belong to a specific subject area. General-purpose Articles about everything and anything
Enthusiast

BTEQ script in BAT file

 

Hi All,

 

I have written a BTEQ script in BAT  file but when i double click this BAT file , it does not run and it only runs through command prompt in BTEQ mode.

 

Actually i am trying to run this BAT file through task scheduler so is there a way to run this BTEQ script in this BAT file in an automated way.

 

Thanks

3 REPLIES
Teradata Employee

Re: BTEQ script in BAT file

Not sure what you are referring to as "BTEQ mode". The bteq script itself is not a valid .bat file, use some other extension for that.

 

The .bat file should have the "bteq" command with stdin redirected from the bteq script file.

For example, the batch file could be something like this:

bteq <bteq-script-file-name 2>&1 >output-log-file-name

 

(The 2>&1 redirects stderr to stdout so you capture any error messages in a single log, along with normal output.)

 

Enthusiast

Re: BTEQ script in BAT file

 

Thanks Fred for the details.

 

It is now running but when i run it through task scheduler the script does not run.

 

Any suggestions.

Highlighted
Teradata Employee

Re: BTEQ script in BAT file

I would need more information as to the nature of the failure.

Did you check the History tab in Task Scheduler (or use the Windows Event Log viewer)?

Was the batch file launched? Was BTEQ invoked?