Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Thu, 08 Mar 2007 @ 12:38:34 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Exiting on BTEQ errors
 
From:   McCall, Glenn David

  I have a bteq script (running on windows) which creates and drops tables. How to quit bteq on the first error?  


  Is there a script level error severity assignment to quit the bteq script on the first valid error?  


  Tried Set Maxerror 4; but it does not work.  


To set a global trap on error level, the "set errorlevel" command should work. I don't know why it didn't work for you, perhaps you should post a short example that doesn't work.

Note that you must set maxerror *before* the query that is likely to fail.

For example:

     .set maxerror 4

     drop table blahblah;

will cause the script to abort if blahblah doesn't exist (at least it does for me).

Whereas:

     drop table blahblah;

     .set maxerror 4

Will not cause the script to fail if blahblah doesn't exist. This is because the errorlevel trap isn't set until after the erroneous query.

Note also that this is a minimum setting. If the query fails with an "errorlevel" that is 1,2,3 or 4, then set maxerror 4 will not cause the script to abort. Only errorlevels 5 and above will cause the script to fail after a set errorlevel 4 command.


I hope this helps

Glenn Mc



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020